Socket
Socket
Sign inDemoInstall

stream-http

Package Overview
Dependencies
Maintainers
1
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stream-http - npm Package Compare versions

Comparing version 1.1.1 to 1.2.0

test/browser/abort.js

18

lib/request.js

@@ -93,2 +93,4 @@ // var Base64 = require('Base64')

if (self._destroyed)
return
var opts = self._opts

@@ -171,2 +173,4 @@

xhr.onerror = function () {
if (self._destroyed)
return
self.emit('error', new Error('XHR error'))

@@ -201,3 +205,3 @@ }

if (!statusValid(self._xhr) || self._failed)
if (!statusValid(self._xhr) || self._destroyed)
return

@@ -214,2 +218,5 @@

if (self._destroyed)
return
self._response = new IncomingMessage(self._xhr, self._fetchResponse, self._mode)

@@ -226,6 +233,11 @@ self.emit('response', self._response)

ClientRequest.prototype.abort = function () {
ClientRequest.prototype.abort = ClientRequest.prototype.destroy = function () {
var self = this
self._destroyed = true
if (self._response)
self._response._destroyed = true
if (self._xhr)
self._xhr.abort()
// Currently, there isn't a way to truly abort a fetch.
// If you like bikeshedding, see https://github.com/whatwg/fetch/issues/27
}

@@ -274,2 +286,2 @@

'via'
];
]

@@ -24,2 +24,10 @@ var capability = require('./capability')

// Fake the 'close' event, but only once 'end' fires
self.on('end', function () {
// The nextTick is necessary to prevent the 'request' module from causing an infinite loop
process.nextTick(function () {
self.emit('close')
})
})
if (mode === 'fetch') {

@@ -41,2 +49,4 @@ self._fetchResponse = response

reader.read().then(function (result) {
if (self._destroyed)
return
if (result.done) {

@@ -43,0 +53,0 @@ self.push(null)

2

package.json
{
"name": "stream-http",
"version": "1.1.1",
"version": "1.2.0",
"description": "Streaming http in the browser",

@@ -5,0 +5,0 @@ "main": "index.js",

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