Comparing version 3.0.0 to 3.0.1
@@ -185,4 +185,4 @@ 'use strict'; | ||
* const http = require('http-call') | ||
* let rsp = await http.get('https://google.com') | ||
* rsp.on('data', console.log) | ||
* let {response} = await http.get('https://google.com') | ||
* response.on('data', console.log) | ||
* ``` | ||
@@ -202,3 +202,3 @@ */ | ||
return class CustomHTTP extends HTTP { | ||
get defaultOptions() { | ||
static get defaultOptions() { | ||
return { | ||
@@ -212,2 +212,16 @@ ...super.defaultOptions, | ||
static get defaultOptions() { | ||
return { | ||
method: 'GET', | ||
host: 'localhost', | ||
protocol: 'https:', | ||
path: '/', | ||
raw: false, | ||
partial: false, | ||
headers: { | ||
'user-agent': `${_package2.default.name}/${_package2.default.version} node-${process.version}` | ||
} | ||
}; | ||
} | ||
// instance properties | ||
@@ -231,6 +245,6 @@ | ||
this.options.protocol = u.protocol || this.options.protocol; | ||
this.options.host = u.hostname || this.defaultOptions.host || 'localhost'; | ||
this.options.host = u.hostname || this.constructor.defaultOptions.host || 'localhost'; | ||
this.options.path = u.path || '/'; | ||
this.options.agent = this.options.agent || _proxy2.default.agent(this.secure); | ||
this.options.port = parseInt(u.port || this.defaultOptions.port || (this.secure ? 443 : 80)); | ||
this.options.port = parseInt(u.port || this.constructor.defaultOptions.port || (this.secure ? 443 : 80)); | ||
} | ||
@@ -245,22 +259,8 @@ get headers() { | ||
} | ||
get defaultOptions() { | ||
return { | ||
method: 'GET', | ||
host: 'localhost', | ||
protocol: 'https:', | ||
path: '/', | ||
raw: false, | ||
partial: false, | ||
headers: { | ||
'user-agent': `${_package2.default.name}/${_package2.default.version} node-${process.version}` | ||
} | ||
}; | ||
} | ||
constructor(url, options = {}) { | ||
this.options = { | ||
...this.defaultOptions, | ||
...this.constructor.defaultOptions, | ||
...options, | ||
headers: lowercaseHeaders({ | ||
...this.defaultOptions.headers, | ||
...this.constructor.defaultOptions.headers, | ||
...options.headers | ||
@@ -267,0 +267,0 @@ }) |
{ | ||
"name": "http-call", | ||
"description": "make http requests", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"author": "Jeff Dickey @dickeyxxx", | ||
@@ -22,3 +22,3 @@ "bugs": "https://github.com/dickeyxxx/http-call/issues", | ||
"babel-plugin-transform-flow-strip-types": "6.22.0", | ||
"flow-bin": "0.52.0", | ||
"flow-bin": "^0.54.0", | ||
"flow-copy-source": "^1.2.1", | ||
@@ -25,0 +25,0 @@ "flow-typed": "^2.1.5", |
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
29513