lib/http.js
function(error, response, data) {
            var complete_response, json = {};

            var contentType = null;
            if (response && response.headers) {
                contentType = utils.trim(response.headers["content-type"] || response.headers["Content-Type"] || response.headers["Content-type"] || response.headers["contentType"]);
            }

            if (utils.startsWith(contentType, "application/json") && data) {
                try {
                    json = this.parseJson(data) || {};
                }
                catch(e) {
                    logger.error("Error in parsing JSON:", data, e);
                    json = data;
                }
            }
            else {
                json = data;
            }

            if (json) {
                logger.printMessages(json.messages);
            }

            complete_response = {
                response: response,
                status: (response ? response.statusCode : 0),
                data: json,
                error: error
            };

            return complete_response;
        }
function(error, response, data) {
            var complete_response, json = {};

            var contentType = null;
            if (response && response.headers) {
                contentType = utils.trim(response.headers["content-type"] || response.headers["Content-Type"] || response.headers["Content-type"] || response.headers["contentType"]);
            }

            if (utils.startsWith(contentType, "application/json") && data) {
                try {
                    json = this.parseJson(data) || {};
                }
                catch(e) {
                    logger.error("Error in parsing JSON:", data, e);
                    json = data;
                }
            }
            else {
                json = data;
            }

            if (json) {
                logger.printMessages(json.messages);
            }

            complete_response = {
                response: response,
                status: (response ? response.statusCode : 0),
                data: json,
                error: error
            };

            return complete_response;
        }
function ( error , response , data ) { var complete_response , json = { } ; var contentType = null ; if ( response && response . headers ) { contentType = utils . trim ( response . headers [ "content-type" ] || response . headers [ "Content-Type" ] || response . headers [ "Content-type" ] || response . headers [ "contentType" ] ) ; } if ( utils . startsWith ( contentType , "application/json" ) && data ) { try { json = this . parseJson ( data ) || { } ; } catch ( e ) { logger . error ( "Error in parsing JSON:" , data , e ) ; json = data ; } } else { json = data ; } if ( json ) { logger . printMessages ( json . messages ) ; } complete_response = { response : response , status : ( response ? response . statusCode : 0 ) , data : json , error : error } ; return complete_response ; }
Generates a unified response with the given parameters.

@param {Object} error An error object, if one exists for the request.
@param {Object} response The response object.
@param {Object} data The response data.
@return {Object} A unified response object.

@method splunkjs.Http
Generates a unified response with the given parameters .