Major updates for testing and grunt, jenkins tests are now powered by the jenkins.sh script in the scripts directory.
This commit is contained in:
@ -29,4 +29,5 @@ angular.module('elasticsearch.client', [])
|
||||
factory.ConnectionPool = require('./lib/connection_pool');
|
||||
factory.Transport = require('./lib/transport');
|
||||
|
||||
return factory;
|
||||
}]);
|
||||
|
||||
@ -72,7 +72,6 @@ api.bulk = ca({
|
||||
method: 'POST'
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Perform a [clearScroll](http://www.elasticsearch.org/guide/reference/api/search/scroll/) request
|
||||
*
|
||||
@ -92,7 +91,6 @@ api.clearScroll = ca({
|
||||
method: 'DELETE'
|
||||
});
|
||||
|
||||
|
||||
api.cluster = function ClusterNS(transport) {
|
||||
this.transport = transport;
|
||||
};
|
||||
@ -108,7 +106,6 @@ api.cluster.prototype.getSettings = ca({
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Perform a [cluster.health](http://elasticsearch.org/guide/reference/api/admin-cluster-health/) request
|
||||
*
|
||||
@ -182,7 +179,6 @@ api.cluster.prototype.health = ca({
|
||||
]
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Perform a [cluster.nodeHotThreads](http://www.elasticsearch.org/guide/reference/api/admin-cluster-nodes-hot-threads/) request
|
||||
*
|
||||
@ -228,7 +224,6 @@ api.cluster.prototype.nodeHotThreads = ca({
|
||||
]
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Perform a [cluster.nodeInfo](http://elasticsearch.org/guide/reference/api/admin-cluster-nodes-info/) request
|
||||
*
|
||||
@ -302,7 +297,6 @@ api.cluster.prototype.nodeInfo = ca({
|
||||
]
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Perform a [cluster.nodeShutdown](http://elasticsearch.org/guide/reference/api/admin-cluster-nodes-shutdown/) request
|
||||
*
|
||||
@ -336,7 +330,6 @@ api.cluster.prototype.nodeShutdown = ca({
|
||||
method: 'POST'
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Perform a [cluster.nodeStats](http://elasticsearch.org/guide/reference/api/admin-cluster-nodes-stats/) request
|
||||
*
|
||||
@ -412,7 +405,6 @@ api.cluster.prototype.nodeStats = ca({
|
||||
]
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Perform a [cluster.putSettings](http://elasticsearch.org/guide/reference/api/admin-cluster-update-settings/) request
|
||||
*
|
||||
@ -425,7 +417,6 @@ api.cluster.prototype.putSettings = ca({
|
||||
method: 'PUT'
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Perform a [cluster.reroute](http://elasticsearch.org/guide/reference/api/admin-cluster-reroute/) request
|
||||
*
|
||||
@ -450,7 +441,6 @@ api.cluster.prototype.reroute = ca({
|
||||
method: 'POST'
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Perform a [cluster.state](http://elasticsearch.org/guide/reference/api/admin-cluster-state/) request
|
||||
*
|
||||
@ -503,7 +493,6 @@ api.cluster.prototype.state = ca({
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Perform a [count](http://elasticsearch.org/guide/reference/api/count/) request
|
||||
*
|
||||
@ -568,7 +557,6 @@ api.count = ca({
|
||||
method: 'POST'
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Perform a [delete](http://elasticsearch.org/guide/reference/api/delete/) request
|
||||
*
|
||||
@ -645,7 +633,6 @@ api['delete'] = ca({
|
||||
method: 'DELETE'
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Perform a [deleteByQuery](http://www.elasticsearch.org/guide/reference/api/delete-by-query/) request
|
||||
*
|
||||
@ -742,7 +729,6 @@ api.deleteByQuery = ca({
|
||||
method: 'DELETE'
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Perform a [exists](http://elasticsearch.org/guide/reference/api/get/) request
|
||||
*
|
||||
@ -796,7 +782,6 @@ api.exists = ca({
|
||||
method: 'HEAD'
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Perform a [explain](http://elasticsearch.org/guide/reference/api/explain/) request
|
||||
*
|
||||
@ -896,7 +881,6 @@ api.explain = ca({
|
||||
method: 'POST'
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Perform a [get](http://elasticsearch.org/guide/reference/api/get/) request
|
||||
*
|
||||
@ -966,7 +950,6 @@ api.get = ca({
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Perform a [getSource](http://elasticsearch.org/guide/reference/api/get/) request
|
||||
*
|
||||
@ -1026,7 +1009,6 @@ api.getSource = ca({
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Perform a [index](http://elasticsearch.org/guide/reference/api/index_/) request
|
||||
*
|
||||
@ -1137,7 +1119,6 @@ api.index = ca({
|
||||
method: 'POST'
|
||||
});
|
||||
|
||||
|
||||
api.indices = function IndicesNS(transport) {
|
||||
this.transport = transport;
|
||||
};
|
||||
@ -1204,7 +1185,6 @@ api.indices.prototype.analyze = ca({
|
||||
method: 'POST'
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Perform a [indices.clearCache](http://www.elasticsearch.org/guide/reference/api/admin-indices-clearcache/) request
|
||||
*
|
||||
@ -1283,7 +1263,6 @@ api.indices.prototype.clearCache = ca({
|
||||
method: 'POST'
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Perform a [indices.close](http://www.elasticsearch.org/guide/reference/api/admin-indices-open-close/) request
|
||||
*
|
||||
@ -1314,7 +1293,6 @@ api.indices.prototype.close = ca({
|
||||
method: 'POST'
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Perform a [indices.create](http://www.elasticsearch.org/guide/reference/api/admin-indices-create-index/) request
|
||||
*
|
||||
@ -1345,7 +1323,6 @@ api.indices.prototype.create = ca({
|
||||
method: 'POST'
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Perform a [indices.delete](http://www.elasticsearch.org/guide/reference/api/admin-indices-delete-index/) request
|
||||
*
|
||||
@ -1380,7 +1357,6 @@ api.indices.prototype['delete'] = ca({
|
||||
method: 'DELETE'
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Perform a [indices.deleteAlias](http://www.elasticsearch.org/guide/reference/api/admin-indices-aliases/) request
|
||||
*
|
||||
@ -1415,7 +1391,6 @@ api.indices.prototype.deleteAlias = ca({
|
||||
method: 'DELETE'
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Perform a [indices.deleteMapping](http://www.elasticsearch.org/guide/reference/api/admin-indices-delete-mapping/) request
|
||||
*
|
||||
@ -1446,7 +1421,6 @@ api.indices.prototype.deleteMapping = ca({
|
||||
method: 'DELETE'
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Perform a [indices.deleteTemplate](http://www.elasticsearch.org/guide/reference/api/admin-indices-templates/) request
|
||||
*
|
||||
@ -1477,7 +1451,6 @@ api.indices.prototype.deleteTemplate = ca({
|
||||
method: 'DELETE'
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Perform a [indices.deleteWarmer](http://www.elasticsearch.org/guide/reference/api/admin-indices-warmers/) request
|
||||
*
|
||||
@ -1532,7 +1505,6 @@ api.indices.prototype.deleteWarmer = ca({
|
||||
method: 'DELETE'
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Perform a [indices.exists](http://www.elasticsearch.org/guide/reference/api/admin-indices-indices-exists/) request
|
||||
*
|
||||
@ -1553,7 +1525,6 @@ api.indices.prototype.exists = ca({
|
||||
method: 'HEAD'
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Perform a [indices.existsAlias](http://www.elasticsearch.org/guide/reference/api/admin-indices-aliases/) request
|
||||
*
|
||||
@ -1599,7 +1570,6 @@ api.indices.prototype.existsAlias = ca({
|
||||
method: 'HEAD'
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Perform a [indices.existsType](http://www.elasticsearch.org/guide/reference/api/admin-indices-types-exists/) request
|
||||
*
|
||||
@ -1636,7 +1606,6 @@ api.indices.prototype.existsType = ca({
|
||||
method: 'HEAD'
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Perform a [indices.flush](http://www.elasticsearch.org/guide/reference/api/admin-indices-flush/) request
|
||||
*
|
||||
@ -1684,7 +1653,6 @@ api.indices.prototype.flush = ca({
|
||||
method: 'POST'
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Perform a [indices.getAlias](http://www.elasticsearch.org/guide/reference/api/admin-indices-aliases/) request
|
||||
*
|
||||
@ -1728,7 +1696,6 @@ api.indices.prototype.getAlias = ca({
|
||||
]
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Perform a [indices.getAliases](http://www.elasticsearch.org/guide/reference/api/admin-indices-aliases/) request
|
||||
*
|
||||
@ -1757,7 +1724,6 @@ api.indices.prototype.getAliases = ca({
|
||||
]
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Perform a [indices.getFieldMapping](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-get-field-mapping.html) request
|
||||
*
|
||||
@ -1811,7 +1777,6 @@ api.indices.prototype.getFieldMapping = ca({
|
||||
]
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Perform a [indices.getMapping](http://www.elasticsearch.org/guide/reference/api/admin-indices-get-mapping/) request
|
||||
*
|
||||
@ -1846,7 +1811,6 @@ api.indices.prototype.getMapping = ca({
|
||||
]
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Perform a [indices.getSettings](http://www.elasticsearch.org/guide/reference/api/admin-indices-get-settings/) request
|
||||
*
|
||||
@ -1869,7 +1833,6 @@ api.indices.prototype.getSettings = ca({
|
||||
]
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Perform a [indices.getTemplate](http://www.elasticsearch.org/guide/reference/api/admin-indices-templates/) request
|
||||
*
|
||||
@ -1892,7 +1855,6 @@ api.indices.prototype.getTemplate = ca({
|
||||
]
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Perform a [indices.getWarmer](http://www.elasticsearch.org/guide/reference/api/admin-indices-warmers/) request
|
||||
*
|
||||
@ -1939,7 +1901,6 @@ api.indices.prototype.getWarmer = ca({
|
||||
]
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Perform a [indices.open](http://www.elasticsearch.org/guide/reference/api/admin-indices-open-close/) request
|
||||
*
|
||||
@ -1970,7 +1931,6 @@ api.indices.prototype.open = ca({
|
||||
method: 'POST'
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Perform a [indices.optimize](http://www.elasticsearch.org/guide/reference/api/admin-indices-optimize/) request
|
||||
*
|
||||
@ -2033,7 +1993,6 @@ api.indices.prototype.optimize = ca({
|
||||
method: 'POST'
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Perform a [indices.putAlias](http://www.elasticsearch.org/guide/reference/api/admin-indices-aliases/) request
|
||||
*
|
||||
@ -2088,7 +2047,6 @@ api.indices.prototype.putAlias = ca({
|
||||
method: 'PUT'
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Perform a [indices.putMapping](http://www.elasticsearch.org/guide/reference/api/admin-indices-put-mapping/) request
|
||||
*
|
||||
@ -2128,7 +2086,6 @@ api.indices.prototype.putMapping = ca({
|
||||
method: 'PUT'
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Perform a [indices.putSettings](http://www.elasticsearch.org/guide/reference/api/admin-indices-update-settings/) request
|
||||
*
|
||||
@ -2159,7 +2116,6 @@ api.indices.prototype.putSettings = ca({
|
||||
method: 'PUT'
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Perform a [indices.putTemplate](http://www.elasticsearch.org/guide/reference/api/admin-indices-templates/) request
|
||||
*
|
||||
@ -2194,7 +2150,6 @@ api.indices.prototype.putTemplate = ca({
|
||||
method: 'PUT'
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Perform a [indices.putWarmer](http://www.elasticsearch.org/guide/reference/api/admin-indices-warmers/) request
|
||||
*
|
||||
@ -2241,7 +2196,6 @@ api.indices.prototype.putWarmer = ca({
|
||||
method: 'PUT'
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Perform a [indices.refresh](http://www.elasticsearch.org/guide/reference/api/admin-indices-refresh/) request
|
||||
*
|
||||
@ -2281,7 +2235,6 @@ api.indices.prototype.refresh = ca({
|
||||
method: 'POST'
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Perform a [indices.segments](http://elasticsearch.org/guide/reference/api/admin-indices-segments/) request
|
||||
*
|
||||
@ -2320,7 +2273,6 @@ api.indices.prototype.segments = ca({
|
||||
]
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Perform a [indices.snapshotIndex](http://www.elasticsearch.org/guide/reference/api/admin-indices-gateway-snapshot/) request
|
||||
*
|
||||
@ -2356,7 +2308,6 @@ api.indices.prototype.snapshotIndex = ca({
|
||||
method: 'POST'
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Perform a [indices.stats](http://elasticsearch.org/guide/reference/api/admin-indices-stats/) request
|
||||
*
|
||||
@ -2474,7 +2425,6 @@ api.indices.prototype.stats = ca({
|
||||
]
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Perform a [indices.status](http://elasticsearch.org/guide/reference/api/admin-indices-status/) request
|
||||
*
|
||||
@ -2521,7 +2471,6 @@ api.indices.prototype.status = ca({
|
||||
]
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Perform a [indices.updateAliases](http://www.elasticsearch.org/guide/reference/api/admin-indices-aliases/) request
|
||||
*
|
||||
@ -2546,7 +2495,6 @@ api.indices.prototype.updateAliases = ca({
|
||||
method: 'POST'
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Perform a [indices.validateQuery](http://www.elasticsearch.org/guide/reference/api/validate/) request
|
||||
*
|
||||
@ -2610,7 +2558,6 @@ api.indices.prototype.validateQuery = ca({
|
||||
method: 'POST'
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Perform a [info](http://elasticsearch.org/guide/) request
|
||||
*
|
||||
@ -2622,7 +2569,6 @@ api.info = ca({
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Perform a [mget](http://elasticsearch.org/guide/reference/api/multi-get/) request
|
||||
*
|
||||
@ -2690,7 +2636,6 @@ api.mget = ca({
|
||||
method: 'POST'
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Perform a [mlt](http://elasticsearch.org/guide/reference/api/more-like-this/) request
|
||||
*
|
||||
@ -2814,7 +2759,6 @@ api.mlt = ca({
|
||||
method: 'POST'
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Perform a [msearch](http://www.elasticsearch.org/guide/reference/api/multi-search/) request
|
||||
*
|
||||
@ -2866,7 +2810,6 @@ api.msearch = ca({
|
||||
method: 'POST'
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Perform a [percolate](http://elasticsearch.org/guide/reference/api/percolate/) request
|
||||
*
|
||||
@ -2897,7 +2840,6 @@ api.percolate = ca({
|
||||
method: 'POST'
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Perform a [scroll](http://www.elasticsearch.org/guide/reference/api/search/scroll/) request
|
||||
*
|
||||
@ -2931,7 +2873,6 @@ api.scroll = ca({
|
||||
method: 'POST'
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Perform a [search](http://www.elasticsearch.org/guide/reference/api/search/) request
|
||||
*
|
||||
@ -3122,7 +3063,6 @@ api.search = ca({
|
||||
method: 'POST'
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Perform a [suggest](http://elasticsearch.org/guide/reference/api/search/suggest/) request
|
||||
*
|
||||
@ -3170,7 +3110,6 @@ api.suggest = ca({
|
||||
method: 'POST'
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Perform a [update](http://elasticsearch.org/guide/reference/api/update/) request
|
||||
*
|
||||
@ -3297,5 +3236,4 @@ api.create = ca.proxy(api.index, {
|
||||
transform: function (params) {
|
||||
params.op_type = 'create';
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
2
src/lib/connectors/angular.js
vendored
2
src/lib/connectors/angular.js
vendored
@ -24,7 +24,7 @@ AngularConnector.prototype.request = function (params, cb) {
|
||||
cache: false,
|
||||
timeout: abort.promise
|
||||
}).then(function (response) {
|
||||
cb(null, response.data, response.status);
|
||||
cb(null, response.data, response.status, response.headers);
|
||||
}, function (err) {
|
||||
cb(new ConnectionFault(err.message));
|
||||
});
|
||||
|
||||
@ -68,6 +68,10 @@ HttpConnector.prototype.makeReqParams = function (params) {
|
||||
agent: this.agent
|
||||
};
|
||||
|
||||
if (!reqParams.path) {
|
||||
reqParams.path = '/';
|
||||
}
|
||||
|
||||
var query = this.host.query ? _.clone(this.host.query) : {};
|
||||
|
||||
if (params.query) {
|
||||
@ -87,6 +91,7 @@ HttpConnector.prototype.request = function (params, cb) {
|
||||
var request;
|
||||
var response;
|
||||
var status = 0;
|
||||
var headers;
|
||||
var log = this.log;
|
||||
|
||||
var reqParams = this.makeReqParams(params);
|
||||
@ -116,6 +121,7 @@ HttpConnector.prototype.request = function (params, cb) {
|
||||
request = this.hand.request(reqParams, function (_incoming) {
|
||||
incoming = _incoming;
|
||||
status = incoming.statusCode;
|
||||
headers = incoming.headers;
|
||||
incoming.setEncoding('utf8');
|
||||
response = '';
|
||||
|
||||
|
||||
@ -55,9 +55,9 @@ XhrConnector.prototype.request = function (params, cb) {
|
||||
var async = params.async === false ? false : asyncDefault;
|
||||
|
||||
if (params.auth) {
|
||||
xhr.open(params.method, url, async, params.auth.user, params.auth.pass);
|
||||
xhr.open(params.method || 'GET', url, async, params.auth.user, params.auth.pass);
|
||||
} else {
|
||||
xhr.open(params.method, url, async);
|
||||
xhr.open(params.method || 'GET', url, async);
|
||||
}
|
||||
|
||||
xhr.onreadystatechange = function () {
|
||||
|
||||
@ -305,6 +305,7 @@ Log.prototype.trace = function (method, requestUrl, body, responseBody, response
|
||||
|
||||
function prettyJSON(body) {
|
||||
try {
|
||||
// TESTME
|
||||
return JSON.stringify(JSON.parse(body), null, ' ').replace(/'/g, '\\\'');
|
||||
} catch (e) {
|
||||
return body || '';
|
||||
|
||||
@ -35,7 +35,7 @@ function Transport(config) {
|
||||
this.maxRetries = config.hasOwnProperty('maxRetries') ? config.maxRetries : 3;
|
||||
|
||||
// setup requestTimeout default
|
||||
this.requestTimeout = config.hasOwnProperty('requestTimeout') ? config.requestTimeout : 10000;
|
||||
this.requestTimeout = config.hasOwnProperty('requestTimeout') ? config.requestTimeout : 30000;
|
||||
|
||||
// randomizeHosts option
|
||||
var randomizeHosts = config.hasOwnProperty('randomizeHosts') ? !!config.randomizeHosts : true;
|
||||
@ -98,7 +98,7 @@ Transport.prototype.request = function (params, cb) {
|
||||
var remainingRetries = this.maxRetries;
|
||||
var connection; // set in sendReqWithConnection
|
||||
var aborted = false; // several connector will respond with an error when the request is aborted
|
||||
var requestAbort; // an abort function, returned by connection#request()
|
||||
var requestAborter; // an abort function, returned by connection#request()
|
||||
var requestTimeout; // the general timeout for the total request (inculding all retries)
|
||||
var requestTimeoutId; // the id of the ^timeout
|
||||
var request; // the object returned to the user, might be a promise
|
||||
@ -118,7 +118,7 @@ Transport.prototype.request = function (params, cb) {
|
||||
|
||||
params.req = {
|
||||
method: params.method,
|
||||
path: params.path,
|
||||
path: params.path || '/',
|
||||
query: params.query,
|
||||
body: params.body,
|
||||
};
|
||||
@ -132,18 +132,20 @@ Transport.prototype.request = function (params, cb) {
|
||||
respond(err);
|
||||
} else if (_connection) {
|
||||
connection = _connection;
|
||||
requestAbort = connection.request(params.req, checkRespForFailure);
|
||||
requestAborter = connection.request(params.req, checkRespForFailure);
|
||||
} else {
|
||||
self.log.warning('No living connections');
|
||||
respond(new errors.NoConnections());
|
||||
}
|
||||
}
|
||||
|
||||
function checkRespForFailure(err, body, status) {
|
||||
function checkRespForFailure(err, body, status, headers) {
|
||||
if (aborted) {
|
||||
return;
|
||||
}
|
||||
|
||||
requestAborter = void 0;
|
||||
|
||||
if (err) {
|
||||
connection.setStatus('dead');
|
||||
if (remainingRetries) {
|
||||
@ -156,21 +158,26 @@ Transport.prototype.request = function (params, cb) {
|
||||
}
|
||||
} else {
|
||||
self.log.info('Request complete');
|
||||
respond(void 0, body, status);
|
||||
respond(void 0, body, status, headers);
|
||||
}
|
||||
}
|
||||
|
||||
function respond(err, body, status) {
|
||||
function respond(err, body, status, headers) {
|
||||
if (aborted) {
|
||||
return;
|
||||
}
|
||||
|
||||
clearTimeout(requestTimeoutId);
|
||||
var parsedBody;
|
||||
|
||||
if (!err && body) {
|
||||
parsedBody = self.serializer.deserialize(body);
|
||||
if (parsedBody == null) {
|
||||
err = new errors.Serialization();
|
||||
if (!headers || headers['content-type'] === 'application/json') {
|
||||
parsedBody = self.serializer.deserialize(body);
|
||||
if (parsedBody == null) {
|
||||
err = new errors.Serialization();
|
||||
}
|
||||
} else {
|
||||
parsedBody = body;
|
||||
}
|
||||
}
|
||||
|
||||
@ -222,8 +229,8 @@ Transport.prototype.request = function (params, cb) {
|
||||
aborted = true;
|
||||
remainingRetries = 0;
|
||||
clearTimeout(requestTimeoutId);
|
||||
if (typeof requestAbort === 'function') {
|
||||
requestAbort();
|
||||
if (typeof requestAborter === 'function') {
|
||||
requestAborter();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
1
src/rest-api-spec
Submodule
1
src/rest-api-spec
Submodule
Submodule src/rest-api-spec added at bd7f4e3c5d
Reference in New Issue
Block a user