Commit 1c26c555 authored by analog-nico's avatar analog-nico
Browse files

Fallback if no options provided

parent 7db1d460
Loading
Loading
Loading
Loading
+18 −7
Original line number Diff line number Diff line
@@ -49,10 +49,6 @@ var originalInit = request.Request.prototype.init;

request.Request.prototype.init = function (options) {

    if (_.isString(options.method)) {
        options.method = options.method.toUpperCase();
    }

    var self = this;

    self._rp_promise = new Bluebird(function (resolve, reject) {
@@ -65,10 +61,25 @@ request.Request.prototype.init = function (options) {
    self._rp_callbackOrig = self.callback;
    self.callback = ownCallback;

    if (_.isPlainObject(options)) {

        if (_.isString(options.method)) {
            options.method = options.method.toUpperCase();
        }

        self._rp_options = options;
        self._rp_options.simple = options.simple === false ? false : true;
        self._rp_options.resolveWithFullResponse = options.resolveWithFullResponse === true ? true : false;

    } else {

        self._rp_options = {
            simple: true,
            resolveWithFullResponse: false
        };

    }

    return originalInit.apply(self, arguments);

};