Comparing version 2.6.0 to 2.7.0
@@ -44,9 +44,5 @@ const http = require('http') | ||
var addr | ||
if (typeof opts === 'object') { | ||
addr = url.parse(opts.url) | ||
} else { | ||
addr = url.parse(opts) | ||
} | ||
var options = { | ||
const addr = typeof opts === 'object' ? url.parse(opts.url) : url.parse(opts) | ||
let options = { | ||
'hostname': addr.hostname, | ||
@@ -84,5 +80,5 @@ 'port': addr.port || (addr.protocol.toLowerCase() === 'http:' ? 80 : 443), | ||
var req | ||
let req | ||
const resHandler = (res) => { | ||
var stream = res | ||
let stream = res | ||
if (options.compressed === true) { | ||
@@ -145,3 +141,3 @@ if (res.headers['content-encoding'] === 'gzip') { | ||
if (opts.hasOwnProperty('data')) { | ||
var postData = opts.data | ||
let postData = opts.data | ||
@@ -152,3 +148,4 @@ if (!(opts.data instanceof Buffer) && typeof opts.data === 'object') { | ||
postData = qs.stringify(opts.data) | ||
} else { | ||
} | ||
else { | ||
try { | ||
@@ -174,3 +171,4 @@ postData = JSON.stringify(opts.data) | ||
reject(err) | ||
} else { | ||
} | ||
else { | ||
resolve(res) | ||
@@ -177,0 +175,0 @@ } |
{ | ||
"name": "phin", | ||
"version": "2.6.0", | ||
"version": "2.7.0", | ||
"description": "Ultra-simple, lightweight, dependency-free Node.JS HTTP request client", | ||
@@ -5,0 +5,0 @@ "main": "lib/phin.js", |
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
2
8875
4
156