http2-wrapper
Advanced tools
Comparing version 2.0.8 to 2.0.9
{ | ||
"name": "http2-wrapper", | ||
"version": "2.0.8", | ||
"version": "2.0.9", | ||
"description": "HTTP2 client, just with the familiar `https` API", | ||
@@ -5,0 +5,0 @@ "main": "source", |
@@ -23,2 +23,3 @@ 'use strict'; | ||
HTTP2_HEADER_PATH, | ||
HTTP2_HEADER_AUTHORITY, | ||
HTTP2_METHOD_CONNECT | ||
@@ -106,4 +107,7 @@ } = http2.constants; | ||
this.method = options.method || 'GET'; | ||
this.path = options.path; | ||
if (!(this.method === 'CONNECT' && (options.path === '/' || options.path === undefined))) { | ||
this.path = options.path; | ||
} | ||
this.res = null; | ||
@@ -170,3 +174,5 @@ this.aborted = false; | ||
get path() { | ||
return this[kHeaders][HTTP2_HEADER_PATH]; | ||
const header = this.method === 'CONNECT' ? HTTP2_HEADER_AUTHORITY : HTTP2_HEADER_PATH; | ||
return this[kHeaders][header]; | ||
} | ||
@@ -176,3 +182,5 @@ | ||
if (value) { | ||
this[kHeaders][HTTP2_HEADER_PATH] = value; | ||
const header = this.method === 'CONNECT' ? HTTP2_HEADER_AUTHORITY : HTTP2_HEADER_PATH; | ||
this[kHeaders][header] = value; | ||
} | ||
@@ -215,4 +223,4 @@ } | ||
const callEnd = () => { | ||
// For GET, HEAD and DELETE | ||
if (this._mustNotHaveABody) { | ||
// For GET, HEAD and DELETE and CONNECT | ||
if (this._mustNotHaveABody || this.method === 'CONNECT') { | ||
callback(); | ||
@@ -419,4 +427,4 @@ return; | ||
if (!(':authority' in this[kHeaders]) && !isConnectMethod) { | ||
this[kHeaders][':authority'] = this[kOrigin].host; | ||
if (!(HTTP2_HEADER_AUTHORITY in this[kHeaders]) && !isConnectMethod) { | ||
this[kHeaders][HTTP2_HEADER_AUTHORITY] = this[kOrigin].host; | ||
} | ||
@@ -511,3 +519,7 @@ | ||
this[kHeaders][lowercased] = value; | ||
if (lowercased === 'host' && this.method === 'CONNECT') { | ||
this[kHeaders][HTTP2_HEADER_AUTHORITY] = value; | ||
} else { | ||
this[kHeaders][lowercased] = value; | ||
} | ||
} | ||
@@ -514,0 +526,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
70612
1830