http2-wrapper
Advanced tools
Comparing version 0.7.0 to 0.8.0
{ | ||
"name": "http2-wrapper", | ||
"version": "0.7.0", | ||
"version": "0.8.0", | ||
"description": "HTTP2 client, just with the familiar `https` API", | ||
@@ -5,0 +5,0 @@ "main": "source", |
'use strict'; | ||
const {URL} = require('url'); // eslint-disable-line node/prefer-global/url | ||
const {URL} = require('url'); | ||
const EventEmitter = require('events'); | ||
@@ -4,0 +4,0 @@ const tls = require('tls'); |
'use strict'; | ||
const {URL} = require('url'); // eslint-disable-line node/prefer-global/url | ||
const {URL} = require('url'); | ||
const http = require('http'); | ||
const https = require('https'); | ||
const Http2ClientRequest = require('./client-request'); | ||
const isCompatible = require('./utils/is-compatible'); | ||
const Http2ClientRequest = isCompatible ? require('./client-request') : undefined; | ||
const httpResolveALPN = require('./utils/http-resolve-alpn'); | ||
@@ -31,3 +32,3 @@ const urlToOptions = require('./utils/url-to-options'); | ||
if (alpnProtocol === 'h2') { | ||
if (alpnProtocol === 'h2' && isCompatible) { | ||
return (options, callback) => { | ||
@@ -34,0 +35,0 @@ if (options.agent && options.agent.http2) { |
'use strict'; | ||
const {URL} = require('url'); // eslint-disable-line node/prefer-global/url | ||
const {URL} = require('url'); | ||
const http2 = require('http2'); | ||
@@ -4,0 +4,0 @@ const {Writable} = require('stream'); |
'use strict'; | ||
const http2 = require('http2'); | ||
const agent = require('./agent'); | ||
const ClientRequest = require('./client-request'); | ||
const IncomingMessage = require('./incoming-message'); | ||
const isCompatible = require('./utils/is-compatible'); | ||
const auto = require('./auto'); | ||
const get = (url, options, callback) => { | ||
const req = ClientRequest.request(url, options, callback); | ||
req.end(); | ||
if (isCompatible) { | ||
const http2 = require('http2'); | ||
const agent = require('./agent'); | ||
const ClientRequest = require('./client-request'); | ||
const IncomingMessage = require('./incoming-message'); | ||
return req; | ||
}; | ||
const get = (url, options, callback) => { | ||
const req = ClientRequest.request(url, options, callback); | ||
req.end(); | ||
module.exports = { | ||
...http2, | ||
...agent, | ||
auto, | ||
request: ClientRequest.request, | ||
get, | ||
ClientRequest, | ||
IncomingMessage | ||
}; | ||
return req; | ||
}; | ||
module.exports = { | ||
...http2, | ||
...agent, | ||
auto, | ||
request: ClientRequest.request, | ||
get, | ||
ClientRequest, | ||
IncomingMessage | ||
}; | ||
} else { | ||
module.exports = {auto}; | ||
} |
'use strict'; | ||
const resolveALPN = require('resolve-alpn'); | ||
const calculateServerName = require('./calculate-server-name'); | ||
const isCompatible = require('./is-compatible'); | ||
const ALPNProtocols = isCompatible ? ['h2', 'http/1.1'] : ['http/1.1']; | ||
// Transforms HTTP options into Socket options and resolves ALPN. | ||
module.exports = (options, headers) => { | ||
return resolveALPN({ | ||
ALPNProtocols: ['h2', 'http/1.1'], | ||
ALPNProtocols, | ||
...options, | ||
@@ -10,0 +13,0 @@ port: options.port || 443, |
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
32377
14
737