Popsicle transport for sending requests over HTTP1 and HTTP2.
npm install popsicle-transport-http --save
import { transport } from "popsicle-transport-http";
const req = new Request("/");
const res = await transport()(req, done);
The transport
function sends the Servie Request
to a remote server.
keepAlive?: number
Keep connection alive for re-use with delay between probe (default:5000
, 5 seconds)idleSocketTimeout?: number
Maximum duration for a socket to have no traffic (default:300_000
, 5 minutes)idleRequestTimeout?: number
Maximum duration for a HTTP request to have no traffic (default:30_000
, 30 seconds)servername?: string
Override remote server name for TLSrejectUnauthorized?: boolean
Rejects unauthorized TLS connectionsnegotiateHttpVersion?: NegotiateHttpVersion
Configure HTTP version negotiation (default:HTTP2_FOR_HTTPS
)lookup?: DnsLookup
Override default DNS resolution (default:dns.lookup
)- TLS options:
ca?: string | Buffer | Array<string | Buffer>
Set TLS CAcert?: string | Buffer
Set TLS certificatekey?: string | Buffer
Set TLS keysecureContext?: SecureContext
Set TLS secure contextsecureProtocol?: string
Set TLS secure protocolsecureOptions?: number
Set TLS secure options
- Custom connection managers (default:
Infinity
active sockets):tlsSockets?: ConnectionManager<TLSSocket>
netSockets?: ConnectionManager<Socket>
http2Sessions?: ConnectionManager<ClientHttp2Session>
- Custom create connections (all methods support async promises):
createHttp2Connection?: (authority, socket) => ClientHttp2Session
createNetConnection?: (options) => Socket
createTlsConnection?: (options) => TLSSocket
This project is written using TypeScript and publishes the definitions directly to NPM.
MIT