http2-wrapper
Advanced tools
Comparing version 1.0.0-beta.4.2 to 1.0.0-beta.4.3
{ | ||
"name": "http2-wrapper", | ||
"version": "1.0.0-beta.4.2", | ||
"version": "1.0.0-beta.4.3", | ||
"description": "HTTP2 client, just with the familiar `https` API", | ||
@@ -5,0 +5,0 @@ "main": "source", |
# http2-wrapper | ||
> HTTP2 client, just with the familiar `https` API | ||
[![Build Status](https://travis-ci.org/szmarczak/http2-wrapper.svg?branch=master)](https://travis-ci.org/szmarczak/http2-wrapper) | ||
[![Node CI](https://github.com/szmarczak/http2-wrapper/workflows/Node%20CI/badge.svg)](https://github.com/szmarczak/http2-wrapper/actions) | ||
[![Coverage Status](https://coveralls.io/repos/github/szmarczak/http2-wrapper/badge.svg?branch=master)](https://coveralls.io/github/szmarczak/http2-wrapper?branch=master) | ||
@@ -10,6 +10,8 @@ [![npm](https://img.shields.io/npm/dm/http2-wrapper.svg)](https://www.npmjs.com/package/http2-wrapper) | ||
This package was created to support HTTP2 without the need to rewrite your code.<br> | ||
I recommend adapting to the [`http2`](https://nodejs.org/api/http2.html) module if possible - it's much simpler to use and has many cool features! Well, it doesn't have agents yet... | ||
I recommend adapting to the [`http2`](https://nodejs.org/api/http2.html) module if possible - it's much simpler to use and has many cool features! | ||
**Tip**: `http2-wrapper` is very useful when you rely on other modules that use the HTTP1 API and you want to support HTTP2. | ||
**Pro Tip**: While the native `http2` doesn't have agents yet, you can use `http2-wrapper` Agents and still operate on the native HTTP2 streams. | ||
## Installation | ||
@@ -20,3 +22,4 @@ | ||
It's best to run `http2-wrapper` under [**the latest**](https://nodejs.org/en/download/current/) version of Node. It provides the best stability. | ||
The latest recommended Node.js version is [**13.8.0**](https://nodejs.org/download/release/v13.8.0/).\ | ||
Please do not use newer non-LTS versions as they have many bugs which haven't been fixed yet. | ||
@@ -23,0 +26,0 @@ ## Usage |
@@ -260,3 +260,3 @@ 'use strict'; | ||
stream.on('data', chunk => { | ||
if (!response.push(chunk)) { | ||
if (!response._dumped && !response.push(chunk)) { | ||
stream.pause(); | ||
@@ -263,0 +263,0 @@ } |
@@ -7,11 +7,12 @@ 'use strict'; | ||
protocol: url.protocol, | ||
hostname: url.hostname.startsWith('[') ? url.hostname.slice(1, -1) : url.hostname, | ||
hostname: typeof url.hostname === 'string' && url.hostname.startsWith('[') ? url.hostname.slice(1, -1) : url.hostname, | ||
host: url.host, | ||
hash: url.hash, | ||
search: url.search, | ||
pathname: url.pathname, | ||
path: `${url.pathname}${url.search}`, | ||
href: url.href | ||
href: url.href, | ||
path: `${url.pathname || ''}${url.search || ''}` | ||
}; | ||
if (url.port !== '') { | ||
if (typeof url.port === 'string' && url.port.length !== 0) { | ||
options.port = Number(url.port); | ||
@@ -21,3 +22,3 @@ } | ||
if (url.username || url.password) { | ||
options.auth = `${url.username}:${url.password}`; | ||
options.auth = `${url.username || ''}:${url.password || ''}`; | ||
} | ||
@@ -24,0 +25,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
47940
1069
378