lib/service.js
function makeRequest(user, auth, url, cb, options = {}, headers = {}) {
    const params = getParams(user, auth, url, options, headers);

    const promise = new Promise((resolve, reject) => {
        request(params, (err, response, body) => {
            if (!err && [200, 201, 204, 301].indexOf(response.statusCode) > -1) {
                const result = _.isString(body) ? JSON.parse(body) : body;
                return resolve([undefined, result]);
            } else {
                if (cb) {
                    return resolve([err || body]);
                }
                return reject([err || body]);
            }
        });
    });
    return handleCallback(promise, cb);
}
function makeRequest(user, auth, url, cb, options = {}, headers = {}) {
    const params = getParams(user, auth, url, options, headers);

    const promise = new Promise((resolve, reject) => {
        request(params, (err, response, body) => {
            if (!err && [200, 201, 204, 301].indexOf(response.statusCode) > -1) {
                const result = _.isString(body) ? JSON.parse(body) : body;
                return resolve([undefined, result]);
            } else {
                if (cb) {
                    return resolve([err || body]);
                }
                return reject([err || body]);
            }
        });
    });
    return handleCallback(promise, cb);
}
function makeRequest ( user , auth , url , cb , options = { } , headers = { } ) { const params = getParams ( user , auth , url , options , headers ) ; const promise = new Promise ( ( resolve , reject ) => { request ( params , ( err , response , body ) => { if ( ! err && [ 200 , 201 , 204 , 301 ] . indexOf ( response . statusCode ) > - 1 ) { const result = _ . isString ( body ) ? JSON . parse ( body ) : body ; return resolve ( [ undefined , result ] ) ; } else { if ( cb ) { return resolve ( [ err || body ] ) ; } return reject ( [ err || body ] ) ; } } ) ; } ) ; return handleCallback ( promise , cb ) ; }
Makes the http request
Makes the http request