Skip to content
Snippets Groups Projects
index.js 7.33 MiB
Newer Older
  • Learn to ignore specific revisions
  • module.exports = function(Promise, INTERNAL) {
    var PromiseMap = Promise.map;
    
    Promise.prototype.filter = function (fn, options) {
        return PromiseMap(this, fn, options, INTERNAL);
    };
    
    Promise.filter = function (promises, fn, options) {
        return PromiseMap(promises, fn, options, INTERNAL);
    };
    };
    
    
    /***/ }),
    /* 62 */
    /***/ (function(module, exports, __webpack_require__) {
    
    "use strict";
    
    
    var core = __webpack_require__(63),
        isArray = __webpack_require__(75),
        isFunction = __webpack_require__(65),
        isObjectLike = __webpack_require__(73);
    
    
    module.exports = function (options) {
    
        var errorText = 'Please verify options'; // For better minification because this string is repeating
    
        if (!isObjectLike(options)) {
            throw new TypeError(errorText);
        }
    
        if (!isFunction(options.request)) {
            throw new TypeError(errorText + '.request');
        }
    
        if (!isArray(options.expose) || options.expose.length === 0) {
            throw new TypeError(errorText + '.expose');
        }
    
    
        var plumbing = core({
            PromiseImpl: options.PromiseImpl,
            constructorMixin: options.constructorMixin
        });
    
    
        // Intercepting Request's init method
    
        var originalInit = options.request.Request.prototype.init;
    
        options.request.Request.prototype.init = function RP$initInterceptor(requestOptions) {
    
            // Init may be called again - currently in case of redirects
            if (isObjectLike(requestOptions) && !this._callback && !this._rp_promise) {
    
                plumbing.init.call(this, requestOptions);
    
            }
    
            return originalInit.apply(this, arguments);
    
        };
    
    
        // Exposing the Promise capabilities
    
        var thenExposed = false;
        for ( var i = 0; i < options.expose.length; i+=1 ) {
    
            var method = options.expose[i];
    
            plumbing[ method === 'promise' ? 'exposePromise' : 'exposePromiseMethod' ](
                options.request.Request.prototype,
                null,
                '_rp_promise',
                method
            );
    
            if (method === 'then') {
                thenExposed = true;
            }
    
        }
    
        if (!thenExposed) {
            throw new Error('Please expose "then"');
        }
    
    };
    
    
    /***/ }),
    /* 63 */
    /***/ (function(module, exports, __webpack_require__) {
    
    "use strict";
    
    
    var errors = __webpack_require__(64),
        isFunction = __webpack_require__(65),
        isObjectLike = __webpack_require__(73),
        isString = __webpack_require__(74),
        isUndefined = __webpack_require__(76);
    
    
    module.exports = function (options) {
    
        var errorText = 'Please verify options'; // For better minification because this string is repeating
    
        if (!isObjectLike(options)) {
            throw new TypeError(errorText);
        }
    
        if (!isFunction(options.PromiseImpl)) {
    
    Romain CREY's avatar
    Romain CREY committed
            throw new TypeError(errorText + '.PromiseImpl');
        }
    
        if (!isUndefined(options.constructorMixin) && !isFunction(options.constructorMixin)) {
            throw new TypeError(errorText + '.PromiseImpl');
        }
    
        var PromiseImpl = options.PromiseImpl;
        var constructorMixin = options.constructorMixin;
    
    
        var plumbing = {};
    
        plumbing.init = function (requestOptions) {
    
            var self = this;
    
            self._rp_promise = new PromiseImpl(function (resolve, reject) {
                self._rp_resolve = resolve;
                self._rp_reject = reject;
                if (constructorMixin) {
                    constructorMixin.apply(self, arguments); // Using arguments since specific Promise libraries may pass additional parameters
                }
            });
    
            self._rp_callbackOrig = requestOptions.callback;
            requestOptions.callback = self.callback = function RP$callback(err, response, body) {
                plumbing.callback.call(self, err, response, body);
            };
    
            if (isString(requestOptions.method)) {
                requestOptions.method = requestOptions.method.toUpperCase();
            }
    
            requestOptions.transform = requestOptions.transform || plumbing.defaultTransformations[requestOptions.method];
    
            self._rp_options = requestOptions;
            self._rp_options.simple = requestOptions.simple !== false;
            self._rp_options.resolveWithFullResponse = requestOptions.resolveWithFullResponse === true;
            self._rp_options.transform2xxOnly = requestOptions.transform2xxOnly === true;
    
        };
    
        plumbing.defaultTransformations = {
            HEAD: function (body, response, resolveWithFullResponse) {
                return resolveWithFullResponse ? response : response.headers;
            }
        };
    
        plumbing.callback = function (err, response, body) {
    
            var self = this;
    
            var origCallbackThrewException = false, thrownException = null;
    
            if (isFunction(self._rp_callbackOrig)) {
                try {
                    self._rp_callbackOrig.apply(self, arguments); // TODO: Apply to self mimics behavior of request@2. Is that also right for request@next?
                } catch (e) {
                    origCallbackThrewException = true;
                    thrownException = e;
                }
            }
    
            var is2xx = !err && /^2/.test('' + response.statusCode);
    
            if (err) {
    
                self._rp_reject(new errors.RequestError(err, self._rp_options, response));
    
            } else if (self._rp_options.simple && !is2xx) {
    
                if (isFunction(self._rp_options.transform) && self._rp_options.transform2xxOnly === false) {
    
                    (new PromiseImpl(function (resolve) {
                        resolve(self._rp_options.transform(body, response, self._rp_options.resolveWithFullResponse)); // transform may return a Promise
                    }))
                        .then(function (transformedResponse) {
                            self._rp_reject(new errors.StatusCodeError(response.statusCode, body, self._rp_options, transformedResponse));
                        })
                        .catch(function (transformErr) {
                            self._rp_reject(new errors.TransformError(transformErr, self._rp_options, response));
                        });
    
                } else {
                    self._rp_reject(new errors.StatusCodeError(response.statusCode, body, self._rp_options, response));
                }
    
            } else {
    
                if (isFunction(self._rp_options.transform) && (is2xx || self._rp_options.transform2xxOnly === false)) {
    
                    (new PromiseImpl(function (resolve) {
                        resolve(self._rp_options.transform(body, response, self._rp_options.resolveWithFullResponse)); // transform may return a Promise
                    }))
                        .then(function (transformedResponse) {
                            self._rp_resolve(transformedResponse);
                        })
                        .catch(function (transformErr) {
                            self._rp_reject(new errors.TransformError(transformErr, self._rp_options, response));
                        });
    
                } else if (self._rp_options.resolveWithFullResponse) {
                    self._rp_resolve(response);
                } else {
                    self._rp_resolve(body);
                }
    
            }
    
            if (origCallbackThrewException) {
                throw thrownException;
            }
    
        };
    
        plumbing.exposePromiseMethod = function (exposeTo, bindTo, promisePropertyKey, methodToExpose, exposeAs) {
    
            exposeAs = exposeAs || methodToExpose;
    
            if (exposeAs in exposeTo) {
                throw new Error('Unable to expose method "' + exposeAs + '"');
            }
    
            exposeTo[exposeAs] = function RP$exposed() {
                var self = bindTo || this;
                return self[promisePropertyKey][methodToExpose].apply(self[promisePropertyKey], arguments);
            };
    
        };
    
        plumbing.exposePromise = function (exposeTo, bindTo, promisePropertyKey, exposeAs) {
    
            exposeAs = exposeAs || 'promise';
    
            if (exposeAs in exposeTo) {
                throw new Error('Unable to expose method "' + exposeAs + '"');
            }
    
            exposeTo[exposeAs] = function RP$promise() {
                var self = bindTo || this;
                return self[promisePropertyKey];
            };
    
        };
    
        return plumbing;
    
    };
    
    
    /***/ }),
    
    Romain CREY's avatar
    Romain CREY committed
    /***/ (function(module, exports, __webpack_require__) {
    
    "use strict";
    
    
    
    function RequestError(cause, options, response) {
    
        this.name = 'RequestError';
        this.message = String(cause);
        this.cause = cause;
        this.error = cause; // legacy attribute
        this.options = options;
        this.response = response;
    
        if (Error.captureStackTrace) { // required for non-V8 environments
            Error.captureStackTrace(this);
        }
    
    }
    RequestError.prototype = Object.create(Error.prototype);
    RequestError.prototype.constructor = RequestError;
    
    
    function StatusCodeError(statusCode, body, options, response) {
    
        this.name = 'StatusCodeError';
        this.statusCode = statusCode;
        this.message = statusCode + ' - ' + (JSON && JSON.stringify ? JSON.stringify(body) : body);
        this.error = body; // legacy attribute
        this.options = options;
        this.response = response;
    
        if (Error.captureStackTrace) { // required for non-V8 environments
            Error.captureStackTrace(this);
        }
    
    }
    StatusCodeError.prototype = Object.create(Error.prototype);
    StatusCodeError.prototype.constructor = StatusCodeError;
    
    
    function TransformError(cause, options, response) {
    
        this.name = 'TransformError';
        this.message = String(cause);
        this.cause = cause;
        this.error = cause; // legacy attribute
        this.options = options;
        this.response = response;
    
        if (Error.captureStackTrace) { // required for non-V8 environments
            Error.captureStackTrace(this);
        }
    
    }
    TransformError.prototype = Object.create(Error.prototype);
    TransformError.prototype.constructor = TransformError;
    
    
    module.exports = {
        RequestError: RequestError,
        StatusCodeError: StatusCodeError,
        TransformError: TransformError
    };
    
    
    /***/ }),
    
    Romain CREY's avatar
    Romain CREY committed
    /***/ (function(module, exports, __webpack_require__) {
    
    
    var baseGetTag = __webpack_require__(66),
        isObject = __webpack_require__(72);
    
    Romain CREY's avatar
    Romain CREY committed
    
    /** `Object#toString` result references. */
    var asyncTag = '[object AsyncFunction]',
        funcTag = '[object Function]',
        genTag = '[object GeneratorFunction]',
        proxyTag = '[object Proxy]';
    
    /**
     * Checks if `value` is classified as a `Function` object.
     *
     * @static
     * @memberOf _
     * @since 0.1.0
     * @category Lang
     * @param {*} value The value to check.
     * @returns {boolean} Returns `true` if `value` is a function, else `false`.
     * @example
     *
     * _.isFunction(_);
     * // => true
     *
     * _.isFunction(/abc/);
     * // => false
     */
    function isFunction(value) {
      if (!isObject(value)) {
        return false;
      }
      // The use of `Object#toString` avoids issues with the `typeof` operator
      // in Safari 9 which returns 'object' for typed arrays and other constructors.
      var tag = baseGetTag(value);
      return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
    }
    
    module.exports = isFunction;
    
    
    /***/ }),
    
    Romain CREY's avatar
    Romain CREY committed
    /***/ (function(module, exports, __webpack_require__) {
    
    
    var Symbol = __webpack_require__(67),
        getRawTag = __webpack_require__(70),
        objectToString = __webpack_require__(71);
    
    Romain CREY's avatar
    Romain CREY committed
    
    /** `Object#toString` result references. */
    var nullTag = '[object Null]',
        undefinedTag = '[object Undefined]';
    
    /** Built-in value references. */
    var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
    
    /**
     * The base implementation of `getTag` without fallbacks for buggy environments.
     *
     * @private
     * @param {*} value The value to query.
     * @returns {string} Returns the `toStringTag`.
     */
    function baseGetTag(value) {
      if (value == null) {
        return value === undefined ? undefinedTag : nullTag;
      }
      return (symToStringTag && symToStringTag in Object(value))
        ? getRawTag(value)
        : objectToString(value);
    }
    
    module.exports = baseGetTag;
    
    
    /***/ }),
    
    Romain CREY's avatar
    Romain CREY committed
    /***/ (function(module, exports, __webpack_require__) {
    
    
    var root = __webpack_require__(68);
    
    Romain CREY's avatar
    Romain CREY committed
    
    /** Built-in value references. */
    var Symbol = root.Symbol;
    
    module.exports = Symbol;
    
    
    /***/ }),
    
    Romain CREY's avatar
    Romain CREY committed
    /***/ (function(module, exports, __webpack_require__) {
    
    
    var freeGlobal = __webpack_require__(69);
    
    Romain CREY's avatar
    Romain CREY committed
    
    /** Detect free variable `self`. */
    var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
    
    /** Used as a reference to the global object. */
    var root = freeGlobal || freeSelf || Function('return this')();
    
    module.exports = root;
    
    
    /***/ }),
    
    Romain CREY's avatar
    Romain CREY committed
    /***/ (function(module, exports) {
    
    /** Detect free variable `global` from Node.js. */
    var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
    
    module.exports = freeGlobal;
    
    
    /***/ }),
    
    Romain CREY's avatar
    Romain CREY committed
    /***/ (function(module, exports, __webpack_require__) {
    
    
    var Symbol = __webpack_require__(67);
    
    Romain CREY's avatar
    Romain CREY committed
    
    /** Used for built-in method references. */
    var objectProto = Object.prototype;
    
    /** Used to check objects for own properties. */
    var hasOwnProperty = objectProto.hasOwnProperty;
    
    /**
     * Used to resolve the
     * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
     * of values.
     */
    var nativeObjectToString = objectProto.toString;
    
    /** Built-in value references. */
    var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
    
    /**
     * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
     *
     * @private
     * @param {*} value The value to query.
     * @returns {string} Returns the raw `toStringTag`.
     */
    function getRawTag(value) {
      var isOwn = hasOwnProperty.call(value, symToStringTag),
          tag = value[symToStringTag];
    
      try {
        value[symToStringTag] = undefined;
        var unmasked = true;
      } catch (e) {}
    
      var result = nativeObjectToString.call(value);
      if (unmasked) {
        if (isOwn) {
          value[symToStringTag] = tag;
        } else {
          delete value[symToStringTag];
        }
      }
      return result;
    }
    
    module.exports = getRawTag;
    
    
    /***/ }),
    
    Romain CREY's avatar
    Romain CREY committed
    /***/ (function(module, exports) {
    
    /** Used for built-in method references. */
    var objectProto = Object.prototype;
    
    /**
     * Used to resolve the
     * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
     * of values.
     */
    var nativeObjectToString = objectProto.toString;
    
    /**
     * Converts `value` to a string using `Object.prototype.toString`.
     *
     * @private
     * @param {*} value The value to convert.
     * @returns {string} Returns the converted string.
     */
    function objectToString(value) {
      return nativeObjectToString.call(value);
    }
    
    module.exports = objectToString;
    
    
    /***/ }),
    
    Romain CREY's avatar
    Romain CREY committed
    /***/ (function(module, exports) {
    
    /**
     * Checks if `value` is the
     * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
     * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
     *
     * @static
     * @memberOf _
     * @since 0.1.0
     * @category Lang
     * @param {*} value The value to check.
     * @returns {boolean} Returns `true` if `value` is an object, else `false`.
     * @example
     *
     * _.isObject({});
     * // => true
     *
     * _.isObject([1, 2, 3]);
     * // => true
     *
     * _.isObject(_.noop);
     * // => true
     *
     * _.isObject(null);
     * // => false
     */
    function isObject(value) {
      var type = typeof value;
      return value != null && (type == 'object' || type == 'function');
    }
    
    module.exports = isObject;
    
    
    /***/ }),
    
    Romain CREY's avatar
    Romain CREY committed
    /***/ (function(module, exports) {
    
    /**
     * Checks if `value` is object-like. A value is object-like if it's not `null`
     * and has a `typeof` result of "object".
     *
     * @static
     * @memberOf _
     * @since 4.0.0
     * @category Lang
     * @param {*} value The value to check.
     * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
     * @example
     *
     * _.isObjectLike({});
     * // => true
     *
     * _.isObjectLike([1, 2, 3]);
     * // => true
     *
     * _.isObjectLike(_.noop);
     * // => false
     *
     * _.isObjectLike(null);
     * // => false
     */
    function isObjectLike(value) {
      return value != null && typeof value == 'object';
    }
    
    module.exports = isObjectLike;
    
    
    /***/ }),
    
    Romain CREY's avatar
    Romain CREY committed
    /***/ (function(module, exports, __webpack_require__) {
    
    
    var baseGetTag = __webpack_require__(66),
        isArray = __webpack_require__(75),
        isObjectLike = __webpack_require__(73);
    
    Romain CREY's avatar
    Romain CREY committed
    
    /** `Object#toString` result references. */
    var stringTag = '[object String]';
    
    /**
     * Checks if `value` is classified as a `String` primitive or object.
     *
     * @static
     * @since 0.1.0
     * @memberOf _
     * @category Lang
     * @param {*} value The value to check.
     * @returns {boolean} Returns `true` if `value` is a string, else `false`.
     * @example
     *
     * _.isString('abc');
     * // => true
     *
     * _.isString(1);
     * // => false
     */
    function isString(value) {
      return typeof value == 'string' ||
        (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);
    }
    
    module.exports = isString;
    
    
    /***/ }),
    
    Romain CREY's avatar
    Romain CREY committed
    /***/ (function(module, exports) {
    
    /**
     * Checks if `value` is classified as an `Array` object.
     *
     * @static
     * @memberOf _
     * @since 0.1.0
     * @category Lang
     * @param {*} value The value to check.
     * @returns {boolean} Returns `true` if `value` is an array, else `false`.
     * @example
     *
     * _.isArray([1, 2, 3]);
     * // => true
     *
     * _.isArray(document.body.children);
     * // => false
     *
     * _.isArray('abc');
     * // => false
     *
     * _.isArray(_.noop);
     * // => false
     */
    var isArray = Array.isArray;
    
    module.exports = isArray;
    
    
    /***/ }),
    
    Romain CREY's avatar
    Romain CREY committed
    /***/ (function(module, exports) {
    
    /**
     * Checks if `value` is `undefined`.
     *
     * @static
     * @since 0.1.0
     * @memberOf _
     * @category Lang
     * @param {*} value The value to check.
     * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
     * @example
     *
     * _.isUndefined(void 0);
     * // => true
     *
     * _.isUndefined(null);
     * // => false
     */
    function isUndefined(value) {
      return value === undefined;
    }
    
    module.exports = isUndefined;
    
    
    /***/ }),
    
    Romain CREY's avatar
    Romain CREY committed
    /***/ (function(module, exports, __webpack_require__) {
    
    "use strict";
    
    
    var isNative = /\.node$/;
    
    function forEach(obj, callback) {
        for ( var key in obj ) {
            if (!Object.prototype.hasOwnProperty.call(obj, key)) {
                continue;
            }
            callback(key);
        }
    }
    
    function assign(target, source) {
        forEach(source, function (key) {
            target[key] = source[key];
        });
        return target;
    }
    
    function clearCache(requireCache) {
        forEach(requireCache, function (resolvedPath) {
            if (!isNative.test(resolvedPath)) {
                delete requireCache[resolvedPath];
            }
        });
    }
    
    module.exports = function (requireCache, callback, callbackForModulesToKeep, module) {
    
        var originalCache = assign({}, requireCache);
        clearCache(requireCache);
    
        if (callbackForModulesToKeep) {
    
            var originalModuleChildren = module.children ? module.children.slice() : false; // Creates a shallow copy of module.children
    
            callbackForModulesToKeep();
    
            // Lists the cache entries made by callbackForModulesToKeep()
            var modulesToKeep = [];
            forEach(requireCache, function (key) {
                modulesToKeep.push(key);
            });
    
            // Discards the modules required in callbackForModulesToKeep()
            clearCache(requireCache);
    
            if (module.children) { // Only true for node.js
                module.children = originalModuleChildren; // Removes last references to modules required in callbackForModulesToKeep() -> No memory leak
            }
    
            // Takes the cache entries of the original cache in case the modules where required before
            for ( var i = 0; i < modulesToKeep.length; i+=1 ) {
                if (originalCache[modulesToKeep[i]]) {
                    requireCache[modulesToKeep[i]] = originalCache[modulesToKeep[i]];
                }
            }
    
        }
    
        var freshModule = callback();
    
        var stealthCache = callbackForModulesToKeep ? assign({}, requireCache) : false;
    
        clearCache(requireCache);
    
        if (callbackForModulesToKeep) {
            // In case modules to keep were required inside the stealthy require for the first time, copy them to the restored cache
            for ( var k = 0; k < modulesToKeep.length; k+=1 ) {
                if (stealthCache[modulesToKeep[k]]) {
                    requireCache[modulesToKeep[k]] = stealthCache[modulesToKeep[k]];
                }
            }
        }
    
        assign(requireCache, originalCache);
    
        return freshModule;
    
    };
    
    
    /***/ }),
    
    Romain CREY's avatar
    Romain CREY committed
    /***/ (function(module, exports, __webpack_require__) {
    
    "use strict";
    // Copyright 2010-2012 Mikeal Rogers
    //
    //    Licensed under the Apache License, Version 2.0 (the "License");
    //    you may not use this file except in compliance with the License.
    //    You may obtain a copy of the License at
    //
    //        http://www.apache.org/licenses/LICENSE-2.0
    //
    //    Unless required by applicable law or agreed to in writing, software
    //    distributed under the License is distributed on an "AS IS" BASIS,
    //    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    //    See the License for the specific language governing permissions and
    //    limitations under the License.
    
    
    
    
    var extend = __webpack_require__(79)
    var cookies = __webpack_require__(80)
    var helpers = __webpack_require__(93)
    
    Romain CREY's avatar
    Romain CREY committed
    
    var paramsHaveRequestBody = helpers.paramsHaveRequestBody
    
    // organize params for patch, post, put, head, del
    function initParams (uri, options, callback) {
      if (typeof options === 'function') {
        callback = options
      }
    
      var params = {}
    
      if (options !== null && typeof options === 'object') {
    
    Romain CREY's avatar
    Romain CREY committed
        extend(params, options, {uri: uri})
      } else if (typeof uri === 'string') {
        extend(params, {uri: uri})
      } else {
        extend(params, uri)
      }
    
      params.callback = callback || params.callback
      return params
    }
    
    function request (uri, options, callback) {
      if (typeof uri === 'undefined') {
        throw new Error('undefined is not a valid uri or options object.')
      }
    
      var params = initParams(uri, options, callback)
    
      if (params.method === 'HEAD' && paramsHaveRequestBody(params)) {
        throw new Error('HTTP HEAD requests MUST NOT include a request body.')
      }
    
      return new request.Request(params)
    }
    
    function verbFunc (verb) {
      var method = verb.toUpperCase()
      return function (uri, options, callback) {
        var params = initParams(uri, options, callback)
        params.method = method
        return request(params, params.callback)
      }
    }
    
    // define like this to please codeintel/intellisense IDEs
    request.get = verbFunc('get')
    request.head = verbFunc('head')
    request.options = verbFunc('options')
    request.post = verbFunc('post')
    request.put = verbFunc('put')
    request.patch = verbFunc('patch')
    request.del = verbFunc('delete')
    request['delete'] = verbFunc('delete')
    
    request.jar = function (store) {
      return cookies.jar(store)
    }
    
    request.cookie = function (str) {
      return cookies.parse(str)
    }
    
    function wrapRequestMethod (method, options, requester, verb) {
      return function (uri, opts, callback) {
        var params = initParams(uri, opts, callback)
    
        var target = {}
        extend(true, target, options, params)
    
        target.pool = params.pool || options.pool
    
        if (verb) {
          target.method = verb.toUpperCase()
        }
    
        if (typeof requester === 'function') {
          method = requester
        }
    
        return method(target, target.callback)
      }
    }
    
    request.defaults = function (options, requester) {
      var self = this
    
      options = options || {}
    
      if (typeof options === 'function') {
        requester = options
        options = {}
      }
    
      var defaults = wrapRequestMethod(self, options, requester)
    
      var verbs = ['get', 'head', 'post', 'put', 'patch', 'del', 'delete']
      verbs.forEach(function (verb) {
        defaults[verb] = wrapRequestMethod(self[verb], options, requester, verb)
      })
    
      defaults.cookie = wrapRequestMethod(self.cookie, options, requester)
      defaults.jar = self.jar
      defaults.defaults = self.defaults
      return defaults
    }
    
    request.forever = function (agentOptions, optionsArg) {
      var options = {}
      if (optionsArg) {
        extend(options, optionsArg)
      }
      if (agentOptions) {
        options.agentOptions = agentOptions
      }
    
      options.forever = true
      return request.defaults(options)
    }
    
    // Exports
    
    module.exports = request
    
    request.Request = __webpack_require__(97)
    
    Romain CREY's avatar
    Romain CREY committed
    request.initParams = initParams
    
    // Backwards compatibility for request.debug
    Object.defineProperty(request, 'debug', {
      enumerable: true,
      get: function () {
        return request.Request.debug
      },
      set: function (debug) {
        request.Request.debug = debug
      }
    })
    
    
    /***/ }),
    
    Romain CREY's avatar
    Romain CREY committed
    /***/ (function(module, exports, __webpack_require__) {
    
    "use strict";
    
    
    var hasOwn = Object.prototype.hasOwnProperty;
    var toStr = Object.prototype.toString;
    var defineProperty = Object.defineProperty;
    var gOPD = Object.getOwnPropertyDescriptor;
    
    var isArray = function isArray(arr) {
    	if (typeof Array.isArray === 'function') {
    		return Array.isArray(arr);
    	}
    
    	return toStr.call(arr) === '[object Array]';
    };
    
    var isPlainObject = function isPlainObject(obj) {
    	if (!obj || toStr.call(obj) !== '[object Object]') {
    		return false;
    	}
    
    	var hasOwnConstructor = hasOwn.call(obj, 'constructor');
    	var hasIsPrototypeOf = obj.constructor && obj.constructor.prototype && hasOwn.call(obj.constructor.prototype, 'isPrototypeOf');
    	// Not own constructor property must be Object
    	if (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) {
    		return false;
    	}
    
    	// Own properties are enumerated firstly, so to speed up,
    	// if last one is own, then all properties are own.
    	var key;
    	for (key in obj) { /**/ }
    
    	return typeof key === 'undefined' || hasOwn.call(obj, key);
    };
    
    // If name is '__proto__', and Object.defineProperty is available, define __proto__ as an own property on target
    var setProperty = function setProperty(target, options) {
    	if (defineProperty && options.name === '__proto__') {
    		defineProperty(target, options.name, {
    			enumerable: true,
    			configurable: true,
    			value: options.newValue,
    			writable: true
    		});
    	} else {
    		target[options.name] = options.newValue;