lib/utils.js
function passResponse(callback, options) {
    options = options || {};
    return function handleResponse(error, response, body) {
        if (error) {
            return callback(new errors.io.IOError(error.mesage, error));
        }
        response = parseResponse(response);
        body = body || { };
        if (response.error) {
            var message = response.body ? response.body.message : "received an empty body";
            var err = new response.ErrorClass(response.statusCode, message);
            if (options.post || options.put) return callback(err, body, response);
            return callback(err, body.data, body.meta, response);
        }
        if (options.post || options.put) return callback(null, body, response);
        return callback(null, body.data, body.meta, response);
    };
}
function passResponse(callback, options) {
    options = options || {};
    return function handleResponse(error, response, body) {
        if (error) {
            return callback(new errors.io.IOError(error.mesage, error));
        }
        response = parseResponse(response);
        body = body || { };
        if (response.error) {
            var message = response.body ? response.body.message : "received an empty body";
            var err = new response.ErrorClass(response.statusCode, message);
            if (options.post || options.put) return callback(err, body, response);
            return callback(err, body.data, body.meta, response);
        }
        if (options.post || options.put) return callback(null, body, response);
        return callback(null, body.data, body.meta, response);
    };
}
function passResponse ( callback , options ) { options = options || { } ; return function handleResponse ( error , response , body ) { if ( error ) { return callback ( new errors . io . IOError ( error . mesage , error ) ) ; } response = parseResponse ( response ) ; body = body || { } ; if ( response . error ) { var message = response . body ? response . body . message : "received an empty body" ; var err = new response . ErrorClass ( response . statusCode , message ) ; if ( options . post || options . put ) return callback ( err , body , response ) ; return callback ( err , body . data , body . meta , response ) ; } if ( options . post || options . put ) return callback ( null , body , response ) ; return callback ( null , body . data , body . meta , response ) ; } ; }
Parse response then pass to callback

@public

@param {Function} callback - user's callback
@param {Object} [options]
@param {Boolean} [options.post] - callback is for a POST request
@param {Boolean} [options.put] - callback is for a PUT request
@return {Function} function to handle responses from `request` calls
Parse response then pass to callback