Comparing version 1.3.3 to 1.3.4
33
index.js
@@ -108,2 +108,3 @@ 'use strict'; | ||
this._running++; | ||
return req.start(); | ||
@@ -123,2 +124,3 @@ } | ||
const req = this._requests_queue.shift(); | ||
return req.start(); | ||
@@ -142,3 +144,2 @@ } | ||
this.headers = {}; | ||
this.callbacks = {}; | ||
this.request_opts = {}; | ||
@@ -149,3 +150,2 @@ this.retries = 0; | ||
this.follow = false; | ||
this.started = false; | ||
this.encoding = 'utf8'; | ||
@@ -200,2 +200,3 @@ this.logger = console; | ||
this._max_retry = max; | ||
return this; | ||
@@ -207,2 +208,3 @@ } | ||
this._retryables = retryables; | ||
return this; | ||
@@ -215,2 +217,3 @@ } | ||
this.headers[key] = value; | ||
return this; | ||
@@ -222,2 +225,3 @@ } | ||
this.headers[key] = value; | ||
return this; | ||
@@ -229,2 +233,3 @@ } | ||
this.request_opts[key] = value; | ||
return this; | ||
@@ -258,2 +263,3 @@ } | ||
this.additional_arguments = arguments; | ||
return this; | ||
@@ -264,2 +270,3 @@ } | ||
this.encoding = encoding; | ||
return this; | ||
@@ -271,2 +278,3 @@ } | ||
this.follow = true; | ||
return this; | ||
@@ -277,2 +285,3 @@ } | ||
this.auto_format = fmt; | ||
return this; | ||
@@ -283,2 +292,3 @@ } | ||
this.logger = logger; | ||
return this; | ||
@@ -289,2 +299,3 @@ } | ||
this.is_verbose = true; | ||
return this; | ||
@@ -338,2 +349,3 @@ } | ||
this.data = data || ''; | ||
return this; | ||
@@ -442,11 +454,2 @@ } | ||
response.on('close', () => { | ||
this.log('error', 'Response closed'); | ||
this.last_error = { | ||
response: 'Response closed', | ||
code: 500 | ||
}; | ||
this.retry(); | ||
}); | ||
response.on('error', err => { | ||
@@ -483,2 +486,3 @@ this.log('error', 'Response error', err); | ||
this.log('error', 'JSON is invalid'); | ||
return this.cb(e, this.raw, this, this.additional_arguments); | ||
@@ -533,3 +537,5 @@ } | ||
for (temp in this.headers) { | ||
redir.set_header(temp, this.headers[temp]); | ||
if (this.headers.hasOwnProperty(temp)) { | ||
redir.set_header(temp, this.headers[temp]); | ||
} | ||
} | ||
@@ -561,2 +567,3 @@ | ||
this.last_error = err; | ||
return this.retry(); | ||
@@ -586,3 +593,3 @@ } | ||
return new Request('POST'); | ||
} | ||
} | ||
@@ -589,0 +596,0 @@ static get put () { |
{ | ||
"name": "cuddle", | ||
"version": "1.3.3", | ||
"version": "1.3.4", | ||
"description": "Cuddle is a minimal, chainable and readability first http client", | ||
@@ -43,6 +43,7 @@ "main": "index.js", | ||
"babel-preset-es2015": "^6.24.1", | ||
"eslint-plugin-json": "^1.3.2", | ||
"grunt": "^1.0.1", | ||
"grunt-contrib-jshint": "^1.1.0", | ||
"grunt-contrib-watch": "^1.0.0", | ||
"grunt-rollup": "^2.0.1", | ||
"gruntify-eslint": "^5.0.0", | ||
"mocha": "^3.5.0", | ||
@@ -49,0 +50,0 @@ "nock": "^9.0.14", |
@@ -99,5 +99,5 @@ # Cuddle | ||
.args(user) | ||
//.max_retry(10) // default is 3 | ||
//.debug() // if you want to log all | ||
//.logger(winston) // if you want to replace the logger (console) | ||
//.max_retry(10) // to set the number of retries | ||
//.debug() // to log all | ||
//.logger(winston) // to replace the logger (default is console) | ||
.then(bar); | ||
@@ -104,0 +104,0 @@ }); |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
2
18646
10
419