supra-http
Advanced tools
Comparing version 1.0.3 to 1.0.4
@@ -28,3 +28,3 @@ "use strict"; | ||
return circuit | ||
.fire(url, options); | ||
.fire(url, options || {}); | ||
} | ||
@@ -31,0 +31,0 @@ createCircuit(name, options) { |
@@ -10,2 +10,3 @@ "use strict"; | ||
const enums_1 = require("./enums"); | ||
const fast_url_parser_1 = __importDefault(require("fast-url-parser")); | ||
class Http { | ||
@@ -34,3 +35,3 @@ constructor() { | ||
return new Promise(resolve => { | ||
const request = requestProvider.client.request(url, options, response => { | ||
const request = requestProvider.client.request(options, response => { | ||
compression_1.Compression.handle(response) | ||
@@ -48,6 +49,10 @@ .then(body => resolve({ | ||
} | ||
createRequestOptions(url, options, agent, bodyContent) { | ||
createRequestOptions(targetUrl, options, agent, bodyContent) { | ||
const url = fast_url_parser_1.default.parse(targetUrl); | ||
const mergedOptions = { | ||
method: options.method || 'get', | ||
agent, | ||
hostname: url.host, | ||
protocol: url._protocol + ':', | ||
path: url.pathname + (url.search || ''), | ||
headers: Object.assign(Object.assign({}, options.headers), { 'accept-encoding': compression_1.Compression.getSupportedStreams() }) | ||
@@ -54,0 +59,0 @@ }; |
{ | ||
"name": "supra-http", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "Circuit breaking http client for NodeJs. And it is fast...", | ||
@@ -24,2 +24,3 @@ "main": "./dist/index.js", | ||
"dependencies": { | ||
"fast-url-parser": "^1.1.3", | ||
"opossum": "^4.1.0", | ||
@@ -39,2 +40,5 @@ "opossum-hystrix": "0.0.1" | ||
"jest": "^24.9.0", | ||
"nock": "^11.6.0", | ||
"request": "^2.88.0", | ||
"requestretry": "^4.0.2", | ||
"sinon": "^7.5.0", | ||
@@ -41,0 +45,0 @@ "ts-jest": "^24.1.0", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16190
246
3
16
+ Addedfast-url-parser@^1.1.3
+ Addedfast-url-parser@1.1.3(transitive)
+ Addedpunycode@1.4.1(transitive)