popsicle-transport-http
v1.2.1
Published
Popsicle transport for sending requests over HTTP1 and HTTP2
Downloads
658,731
Maintainers
Readme
Popsicle Transport HTTP
Popsicle transport for sending requests over HTTP1 and HTTP2.
Installation
npm install popsicle-transport-http --saveUsage
import { transport } from "popsicle-transport-http";
const req = new Request("/");
const res = await transport()(req, done);Transport Options
The transport function sends the Servie Request to a remote server.
keepAlive?: numberDuration to keep connection alive for re-use (default:5000)servername?: stringOverride remote server name for TLSrejectUnauthorized?: booleanRejects unauthorized TLS connectionsnegotiateHttpVersion?: NegotiateHttpVersionConfigure HTTP version negotiation (default:HTTP2_FOR_HTTPS)lookup?: DnsLookupOverride default DNS resolution (default:dns.lookup)- TLS options:
ca?: string | Buffer | Array<string | Buffer>Set TLS CAcert?: string | BufferSet TLS certificatekey?: string | BufferSet TLS keysecureContext?: SecureContextSet TLS secure contextsecureProtocol?: stringSet TLS secure protocolsecureOptions?: numberSet TLS secure options
- Custom connection managers (default:
Infinityactive sockets):tlsSockets?: ConnectionManager<TLSSocket>netSockets?: ConnectionManager<Socket>http2Sessions?: ConnectionManager<ClientHttp2Session>
- Custom create connections (all methods support async promises):
createHttp2Connection?: (authority, socket) => ClientHttp2SessioncreateNetConnection?: (options) => SocketcreateTlsConnection?: (options) => TLSSocket
TypeScript
This project is written using TypeScript and publishes the definitions directly to NPM.
License
MIT
