Popsicle Transport HTTP
Popsicle transport for sending requests over HTTP1 and HTTP2.
Installation
npm install popsicle-transport-http --save
Usage
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?: DnsLookupEnable custom DNS resolution (default:cacheable-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