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

stream-http

Package Overview
Dependencies
Maintainers
2
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 2.4.0 to 2.4.1

6

lib/capability.js

@@ -10,5 +10,5 @@ exports.fetch = isFunction(global.fetch) && isFunction(global.ReadableStream)

var xhr = new global.XMLHttpRequest()
// If location.host is empty, e.g. if this page/worker was loaded
// from a Blob, then use example.com to avoid an error
xhr.open('GET', global.location.host ? '/' : 'https://example.com')
// If XDomainRequest is available (ie only, where xhr might not work
// cross domain), use the page location. Otherwise use example.com
xhr.open('GET', global.XDomainRequest ? '/' : 'https://example.com')

@@ -15,0 +15,0 @@ function checkTypeSupport (type) {

@@ -37,9 +37,9 @@ var capability = require('./capability')

self.statusMessage = response.statusText
// backwards compatible version of for (<item> of <iterable>):
// for (var <item>,_i,_it = <iterable>[Symbol.iterator](); <item> = (_i = _it.next()).value,!_i.done;)
for (var header, _i, _it = response.headers[Symbol.iterator](); header = (_i = _it.next()).value, !_i.done;) {
self.headers[header[0].toLowerCase()] = header[1]
self.rawHeaders.push(header[0], header[1])
}
response.headers.forEach(function(header, key){
self.headers[key.toLowerCase()] = header
self.rawHeaders.push(key, header)
})
// TODO: this doesn't respect backpressure. Once WritableStream is available, this can be fixed

@@ -46,0 +46,0 @@ var reader = response.body.getReader()

{
"name": "stream-http",
"version": "2.4.0",
"version": "2.4.1",
"description": "Streaming http in the browser",

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

@@ -5,7 +5,7 @@ # stream-http [![Build Status](https://travis-ci.org/jhiesey/stream-http.svg?branch=master)](https://travis-ci.org/jhiesey/stream-http)

This module is an implementation of node's native `http` module for the browser.
It tries to match node's api and behavior as closely as possible, but some features
This module is an implementation of Node's native `http` module for the browser.
It tries to match Node's API and behavior as closely as possible, but some features
aren't available, since browsers don't give nearly as much control over requests.
This is heavily inspired by, and intended to replace, [http-browserify](https://github.com/substack/http-browserify)
This is heavily inspired by, and intended to replace, [http-browserify](https://github.com/substack/http-browserify).

@@ -19,3 +19,3 @@ ## What does it do?

has to be held in memory at once:
* Chrome >= 43 (using the `fetch` api)
* Chrome >= 43 (using the `fetch` API)
* Firefox >= 9 (using `moz-chunked-arraybuffer` responseType with xhr)

@@ -43,14 +43,14 @@

The intent is to have the same api as the client part of the
[node HTTP module](https://nodejs.org/api/http.html). The interfaces are the same wherever
practical, although limitations in browsers make an exact clone of the node api impossible.
The intent is to have the same API as the client part of the
[Node HTTP module](https://nodejs.org/api/http.html). The interfaces are the same wherever
practical, although limitations in browsers make an exact clone of the Node API impossible.
This module implements `http.request`, `http.get`, and most of `http.ClientRequest`
and `http.IncomingMessage` in addition to `http.METHODS` and `http.STATUS_CODES`. See the
node docs for how these work.
Node docs for how these work.
### Extra features compared to node
### Extra features compared to Node
* The `message.url` property provides access to the final url after all redirects. This
is useful since the browser follows all redirects silently, unlike node. It is available
* The `message.url` property provides access to the final URL after all redirects. This
is useful since the browser follows all redirects silently, unlike Node. It is available
in Chrome 37 and newer, Firefox 32 and newer, and Safari 9 and newer.

@@ -63,11 +63,11 @@

the module can make a fairly good decision about which underlying browser features to use,
but sometimes it helps to get a little input from the user.
but sometimes it helps to get a little input from the developer.
* The `options.mode` field passed into `http.request` or `http.get` can take on one of the
following values:
* 'default' (or any falsy value, including undefined): Try to provide partial data before
* 'default' (or any falsy value, including `undefined`): Try to provide partial data before
the request completes, but not at the cost of correctness for binary data or correctness of
the 'content-type' response header. This mode will also avoid slower code paths whenever
possible, which is particularly useful when making large requests in a browser like Safari
that has a weaker javascript engine.
that has a weaker JavaScript engine.
* 'allow-wrong-content-type': Provides partial data in more cases than 'default', but

@@ -79,3 +79,3 @@ at the expense of causing the 'content-type' response header to be incorrectly reported

* 'prefer-stream': Provide data before the request completes even if binary data (anything
that isn't a single-byte ASCII or utf8 character) will be corrupted. Of course, this option
that isn't a single-byte ASCII or UTF8 character) will be corrupted. Of course, this option
is only safe for text data. May also cause the 'content-type' response header to be

@@ -88,3 +88,3 @@ incorrectly reported (as 'text/plain; charset=x-user-defined').

### Features missing compared to node
### Features missing compared to Node

@@ -123,3 +123,3 @@ * `http.Agent` is only a stub

There are two sets of tests: the tests that run in node (found in `test/node`) and the tests
There are two sets of tests: the tests that run in Node (found in `test/node`) and the tests
that run in the browser (found in `test/browser`). Normally the browser tests run on

@@ -132,3 +132,3 @@ [Sauce Labs](http://saucelabs.com/).

To run just the node tests, run `npm run test-node`.
To run just the Node tests, run `npm run test-node`.

@@ -135,0 +135,0 @@ To run the browser tests locally, run `npm run test-browser-local` and point your browser to

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