retry-request
Advanced tools
Comparing version 2.0.3 to 2.0.4
15
index.js
'use strict'; | ||
var firstEvent = require('first-event'); | ||
var request = require('request'); | ||
@@ -77,3 +78,3 @@ var through = require('through2'); | ||
if (requestStream.destroy) { | ||
requestStream.destroy(); | ||
requestStream.destroy(); | ||
} else if (requestStream.end) { | ||
@@ -92,7 +93,11 @@ requestStream.end(); | ||
firstEvent(requestStream, ['error', 'response']) | ||
.then(resp => onResponse.apply(null, [null].concat(resp.args))) | ||
.catch(onResponse); | ||
requestStream | ||
.on('error', onResponse) | ||
.on('response', onResponse.bind(null, null)) | ||
.on('complete', retryStream.emit.bind(retryStream, 'complete')) | ||
.pipe(delayStream); | ||
.on('error', function() {}) // Cannot remove. Node internals get confused: https://github.com/stephenplusplus/retry-request/pull/11#discussion_r118394078 | ||
.on('complete', retryStream.emit.bind(retryStream, 'complete')); | ||
requestStream.pipe(delayStream); | ||
} else { | ||
@@ -99,0 +104,0 @@ activeRequest = opts.request(requestOpts, onResponse); |
{ | ||
"name": "retry-request", | ||
"version": "2.0.3", | ||
"version": "2.0.4", | ||
"description": "Retry a request.", | ||
@@ -25,2 +25,3 @@ "main": "index.js", | ||
"dependencies": { | ||
"first-event": "^1.0.0", | ||
"request": "^2.81.0", | ||
@@ -27,0 +28,0 @@ "through2": "^2.0.0" |
@@ -0,0 +0,0 @@ |![retry-request](logo.png) |
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
8326
124
3
+ Addedfirst-event@^1.0.0
+ Added101@1.6.3(transitive)
+ Addedassert-args@1.2.1(transitive)
+ Addedclone@1.0.4(transitive)
+ Addedcompound-subject@0.0.1(transitive)
+ Addeddebug@2.6.9(transitive)
+ Addeddeep-eql@0.1.3(transitive)
+ Addedfirst-event@1.0.0(transitive)
+ Addedget-prototype-of@0.0.0(transitive)
+ Addedis-capitalized@1.0.0(transitive)
+ Addedis-class@0.0.4(transitive)
+ Addedkeypather@1.10.2(transitive)
+ Addedms@2.0.0(transitive)
+ Addedtype-detect@0.1.1(transitive)