Sha256: 8b9cdd20f12dd87d035de99f2c9edc5762cae78e0d79aebd8fe018423c7635f2

Contents?: true

Size: 706 Bytes

Versions: 9

Compression:

Stored size: 706 Bytes

Contents

'use strict';

var createError = require('./createError');

/**
 * Resolve or reject a Promise based on response status.
 *
 * @param {Function} resolve A function that resolves the promise.
 * @param {Function} reject A function that rejects the promise.
 * @param {object} response The response.
 */
module.exports = function settle(resolve, reject, response) {
  var validateStatus = response.config.validateStatus;
  if (!response.status || !validateStatus || validateStatus(response.status)) {
    resolve(response);
  } else {
    reject(createError(
      'Request failed with status code ' + response.status,
      response.config,
      null,
      response.request,
      response
    ));
  }
};

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
authing_ruby-1.1.4 lib/authing_ruby/test/js_sdk_test/node_modules/axios/lib/core/settle.js
authing_ruby-1.1.3 lib/authing_ruby/test/js_sdk_test/node_modules/axios/lib/core/settle.js
authing_ruby-1.1.2 lib/authing_ruby/test/js_sdk_test/node_modules/axios/lib/core/settle.js
authing_ruby-1.1.1 lib/authing_ruby/test/js_sdk_test/node_modules/axios/lib/core/settle.js
authing_ruby-1.1.0 lib/authing_ruby/test/js_sdk_test/node_modules/axios/lib/core/settle.js
authing_ruby-1.0.9 lib/authing_ruby/test/js_sdk_test/node_modules/axios/lib/core/settle.js
authing_ruby-1.0.8 lib/authing_ruby/test/js_sdk_test/node_modules/axios/lib/core/settle.js
authing_ruby-1.0.7 lib/authing_ruby/test/js_sdk_test/node_modules/axios/lib/core/settle.js
authing_ruby-1.0.6 lib/authing_ruby/test/js_sdk_test/node_modules/axios/lib/core/settle.js