Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

retry-request

Package Overview
Dependencies
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

retry-request - npm Package Compare versions

Comparing version 2.0.4 to 2.0.5

28

index.js
'use strict';
var firstEvent = require('first-event');
var request = require('request');

@@ -43,2 +42,3 @@ var through = require('through2');

var numNoResponseAttempts = 0;
var streamResponseHandled = false;

@@ -90,11 +90,27 @@ var retryStream;

if (streamMode) {
streamResponseHandled = false;
delayStream = through({ objectMode: opts.objectMode });
requestStream = opts.request(requestOpts);
firstEvent(requestStream, ['error', 'response'])
.then(resp => onResponse.apply(null, [null].concat(resp.args)))
.catch(onResponse);
requestStream
// gRPC via google-cloud-node can emit an `error` as well as a `response`
// Whichever it emits, we run with-- we can't run with both. That's what
// is up with the `streamResponseHandled` tracking.
.on('error', function(err) {
if (streamResponseHandled) {
return;
}
requestStream
.on('error', function() {}) // Cannot remove. Node internals get confused: https://github.com/stephenplusplus/retry-request/pull/11#discussion_r118394078
streamResponseHandled = true;
onResponse(err);
})
.on('response', function(resp, body) {
if (streamResponseHandled) {
return;
}
streamResponseHandled = true;
onResponse(null, resp, body);
})
.on('complete', retryStream.emit.bind(retryStream, 'complete'));

@@ -101,0 +117,0 @@

{
"name": "retry-request",
"version": "2.0.4",
"version": "2.0.5",
"description": "Retry a request.",

@@ -25,3 +25,2 @@ "main": "index.js",

"dependencies": {
"first-event": "^1.0.0",
"request": "^2.81.0",

@@ -28,0 +27,0 @@ "through2": "^2.0.0"

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc