v1.3.7: agent passthru (also timeout, setHost, createConnection, family, host, localAddress)

This commit is contained in:
AJ ONeal 2019-02-26 01:02:37 -07:00
parent 4eaf68966c
commit aec78877cf
2 changed files with 11 additions and 1 deletions

View File

@ -188,6 +188,16 @@ function setDefaults(defs) {
Object.keys(opts.uri).forEach(function (key) { Object.keys(opts.uri).forEach(function (key) {
finalOpts[key] = opts.uri[key]; finalOpts[key] = opts.uri[key];
}); });
// A bug should be raised if request does it differently,
// but I think we're supposed to pass all acceptable options
// on to the raw http request
[ 'family', 'host', 'localAddress', 'agent', 'createConnection'
, 'timeout', 'setHost'
].forEach(function (key) {
finalOpts[key] = opts.uri[key];
});
finalOpts.method = opts.method; finalOpts.method = opts.method;
finalOpts.headers = JSON.parse(JSON.stringify(opts.headers)); finalOpts.headers = JSON.parse(JSON.stringify(opts.headers));
if (_body) { if (_body) {

View File

@ -1,6 +1,6 @@
{ {
"name": "@coolaj86/urequest", "name": "@coolaj86/urequest",
"version": "1.3.6", "version": "1.3.7",
"description": "A lightweight drop-in replacement for request", "description": "A lightweight drop-in replacement for request",
"main": "index.js", "main": "index.js",
"files": [ "files": [