Skip to content
VaelJS Blog

node:http

Node-compatible HTTP/1.1 client and server APIs (node:http).

Available in vjs only (not available in vjs-lite). Enabled by default unless --no-node-compat is passed.

import ... from "node:http"
Since v0.0.0-alpha.2 vjs (V8)
Cargo feature: node-compat (enabled by default in vjs; absent in vjs-lite; disable with --no-node-compat)
import { createServer } from "node:http";
const server = createServer((req, res) => {
res.writeHead(200, { "content-type": "text/plain" });
res.end("ok");
});
server.listen(0, "127.0.0.1");
API Symbols
functionSince v0.0.0-alpha.2vjs only
export function createServer(requestListener?: RequestListener): Server;
export function createServer(
  options: ServerOptions,
  requestListener?: RequestListener,
): Server;

Create a new HTTP Server.

Overload 1 — createServer(requestListener?)
NameTypeDescription
requestListener optionalRequestListenerOptional "request" event listener.
Server — New HTTP Server.
Overload 2 — createServer(options, requestListener?)

Create a new HTTP Server with explicit options.

NameTypeDescription
optionsServerOptionsServer configuration.
requestListener optionalRequestListenerOptional "request" event listener.
Server — New HTTP Server.
functionSince v0.0.0-alpha.2vjs only
export function request(
  options: RequestOptions | string | import("node:url").URL,
  callback?: (res: IncomingMessage) => void,
): ClientRequest;
export function request(
  url: string | import("node:url").URL,
  options: RequestOptions,
  callback?: (res: IncomingMessage) => void,
): ClientRequest;

Initiate an HTTP request using options.

Overload 1 — request(options, callback?)
NameTypeDescription
optionsRequestOptions | string | import("node:url").URLRequest options or URL string.
callback optional(res: IncomingMessage) => voidOptional "response" listener.
ClientRequest — Outgoing ClientRequest.
Overload 2 — request(url, options, callback?)

Initiate an HTTP request to url with explicit options.

NameTypeDescription
urlstring | import("node:url").URLTarget URL string or URL.
optionsRequestOptionsRequest options merged over url.
callback optional(res: IncomingMessage) => voidOptional "response" listener.
ClientRequest — Outgoing ClientRequest.
functionSince v0.0.0-alpha.2vjs only
export function get(
  options: RequestOptions | string | import("node:url").URL,
  callback?: (res: IncomingMessage) => void,
): ClientRequest;
export function get(
  url: string | import("node:url").URL,
  options: RequestOptions,
  callback?: (res: IncomingMessage) => void,
): ClientRequest;

Convenience wrapper around request() that forces method "GET" and automatically calls .end().

Overload 1 — get(options, callback?)
NameTypeDescription
optionsRequestOptions | string | import("node:url").URLRequest options or URL string.
callback optional(res: IncomingMessage) => voidOptional "response" listener.
ClientRequest — Outgoing ClientRequest.
Overload 2 — get(url, options, callback?)

Convenience "GET" request to url with explicit options.

NameTypeDescription
urlstring | import("node:url").URLTarget URL string or URL.
optionsRequestOptionsRequest options merged over url.
callback optional(res: IncomingMessage) => voidOptional "response" listener.
ClientRequest — Outgoing ClientRequest.
functionSince v0.0.0-alpha.2vjs only
export function validateHeaderName(name: string): void;

Validate an HTTP header name against RFC 7230 token syntax.

Parameters
NameTypeDescription
namestringHeader name to validate.
Returns
void
Exceptions
  • TypeError — with code = "ERR_INVALID_HTTP_TOKEN" when invalid.
functionSince v0.0.0-alpha.2vjs only
export function validateHeaderValue(name: string, value: unknown): void;

Validate an HTTP header value for prohibited control or CRLF characters.

Parameters
NameTypeDescription
namestringHeader name (used in error diagnostics).
valueunknownHeader value to validate.
Returns
void
Exceptions
  • TypeError — with code = "ERR_INVALID_CHAR" or "ERR_HTTP_INVALID_HEADER_VALUE" when invalid.
classSince v0.0.0-alpha.2vjs only
export class Agent {
  maxSockets: number;
  maxTotalSockets: number;
  maxFreeSockets: number;
  readonly sockets: Record<string, unknown[]>;
  readonly freeSockets: Record<string, unknown[]>;
  readonly requests: Record<string, ClientRequest[]>;
  constructor(options?: AgentOptions);
  destroy(): void;
  getName(options?: RequestOptions): string;
}

Connection-pooling agent managing client HTTP sockets.

Constructor
constructor(options?: AgentOptions);

Construct a new HTTP Agent.

Parameters
NameTypeDescription
options optionalAgentOptionsOptional connection pooling and keep-alive settings.
Properties
PropertyTypeDescriptionSince
maxSockets numberMaximum concurrent sockets per host key.v0.0.0-alpha.2
maxTotalSockets numberMaximum total concurrent sockets across all hosts.v0.0.0-alpha.2
maxFreeSockets numberMaximum idle keep-alive sockets retained per host key.v0.0.0-alpha.2
sockets readonlyRecord<string, unknown[]>Active sockets keyed by getName() destination string.v0.0.0-alpha.2
freeSockets readonlyRecord<string, unknown[]>Idle keep-alive sockets keyed by getName() destination string.v0.0.0-alpha.2
requests readonlyRecord<string, ClientRequest[]>Queued pending requests keyed by getName() destination string.v0.0.0-alpha.2
Methods
methodSince v0.0.0-alpha.2
destroy(): void;

Destroy all sockets currently managed by this agent.

Returns
void
methodSince v0.0.0-alpha.2
getName(options?: RequestOptions): string;

Return the canonical pool key string for options.

Parameters
NameTypeDescription
options optionalRequestOptions—
Returns
string
classSince v0.0.0-alpha.2vjs only
export class IncomingMessage {
  readonly aborted: boolean;
  readonly complete: boolean;
  readonly headers: IncomingHttpHeaders;
  readonly headersDistinct: Record<string, string[]>;
  readonly httpVersion: string;
  readonly httpVersionMajor: number;
  readonly httpVersionMinor: number;
  method?: string;
  readonly rawHeaders: string[];
  readonly rawTrailers: string[];
  readonly socket: unknown;
  statusCode?: number;
  statusMessage?: string;
  readonly trailers: Record<string, string | undefined>;
  readonly trailersDistinct: Record<string, string[]>;
  url?: string;
  readonly readable: boolean;
  readonly readableEnded: boolean;
  readonly destroyed: boolean;
  constructor(socket: unknown);
  setTimeout(msecs: number, callback?: () => void): this;
  setEncoding(encoding: string): this;
  read(size?: number): any;
  pause(): this;
  resume(): this;
  destroy(error?: Error): this;
  pipe<T extends { write(chunk: any, ...args: any[]): any; end(...args: any[]): any }>(
      destination: T,
      options?: { end?: boolean },
    ): T;
  on(eventName: string | symbol, listener: (...args: any[]) => void): this;
  once(eventName: string | symbol, listener: (...args: any[]) => void): this;
  off(eventName: string | symbol, listener: (...args: any[]) => void): this;
  emit(eventName: string | symbol, ...args: any[]): boolean;
  [Symbol.asyncIterator](): AsyncIterableIterator<any>;
}

Readable stream representing an inbound HTTP server request or client response.

Constructor
constructor(socket: unknown);

Construct an IncomingMessage.

Parameters
NameTypeDescription
socketunknownUnderlying socket object.
Properties
PropertyTypeDescriptionSince
aborted readonlybooleantrue if the message was aborted before completion.v0.0.0-alpha.2
complete readonlybooleantrue once the complete HTTP message has been received.v0.0.0-alpha.2
headers readonlyIncomingHttpHeadersParsed lowercased request/response headers.v0.0.0-alpha.2
headersDistinct readonlyRecord<string, string[]>Parsed headers with every key mapped to an array of values.v0.0.0-alpha.2
httpVersion readonlystringHTTP protocol version string (for example "1.1").v0.0.0-alpha.2
httpVersionMajor readonlynumberHTTP major version number.v0.0.0-alpha.2
httpVersionMinor readonlynumberHTTP minor version number.v0.0.0-alpha.2
method optionalstringHTTP request method ("GET", "POST", etc.) on server requests.v0.0.0-alpha.2
rawHeaders readonlystring[]Raw alternating [name, value, ...] header array in wire order.v0.0.0-alpha.2
rawTrailers readonlystring[]Raw alternating [name, value, ...] trailer array.v0.0.0-alpha.2
socket readonlyunknownUnderlying connection socket.v0.0.0-alpha.2
statusCode optionalnumberHTTP response status code (for client responses).v0.0.0-alpha.2
statusMessage optionalstringHTTP response status reason phrase (for client responses).v0.0.0-alpha.2
trailers readonlyRecord<string, string | undefined>Parsed HTTP trailers received after the body.v0.0.0-alpha.2
trailersDistinct readonlyRecord<string, string[]>Parsed HTTP trailers with array values.v0.0.0-alpha.2
url optionalstringRequest URL path and query string on server requests.v0.0.0-alpha.2
readable readonlybooleanWhether the stream is currently readable.v0.0.0-alpha.2
readableEnded readonlybooleanWhether "end" has been emitted.v0.0.0-alpha.2
destroyed readonlybooleanWhether destroy() has been called.v0.0.0-alpha.2
Methods
methodSince v0.0.0-alpha.2
setTimeout(msecs: number, callback?: () => void): this;

Set inactivity timeout on the underlying socket.

Parameters
NameTypeDescription
msecsnumber—
callback optional() => void—
Returns
this
methodSince v0.0.0-alpha.2
setEncoding(encoding: string): this;

Set character encoding for emitted "data" chunks.

Parameters
NameTypeDescription
encodingstring—
Returns
this
methodSince v0.0.0-alpha.2
read(size?: number): any;

Pull buffered body chunks.

Parameters
NameTypeDescription
size optionalnumber—
Returns
any
methodSince v0.0.0-alpha.2
pause(): this;

Pause "data" event emission.

Returns
this
methodSince v0.0.0-alpha.2
resume(): this;

Resume "data" event emission.

Returns
this
methodSince v0.0.0-alpha.2
destroy(error?: Error): this;

Destroy the message stream.

Parameters
NameTypeDescription
error optionalError—
Returns
this
methodSince v0.0.0-alpha.2
pipe<T extends { write(chunk: any, ...args: any[]): any; end(...args: any[]): any }>(
  destination: T,
  options?: { end?: boolean },
): T;

Pipe body chunks into destination.

Parameters
NameTypeDescription
destinationT—
options optional{ end?: boolean }—
Returns
T
methodSince v0.0.0-alpha.2
on(eventName: string | symbol, listener: (...args: any[]) => void): this;

Register an event listener.

Parameters
NameTypeDescription
eventNamestring | symbol—
listener(...args: any[]) => void—
Returns
this
methodSince v0.0.0-alpha.2
once(eventName: string | symbol, listener: (...args: any[]) => void): this;

Register a one-time event listener.

Parameters
NameTypeDescription
eventNamestring | symbol—
listener(...args: any[]) => void—
Returns
this
methodSince v0.0.0-alpha.2
off(eventName: string | symbol, listener: (...args: any[]) => void): this;

Remove an event listener.

Parameters
NameTypeDescription
eventNamestring | symbol—
listener(...args: any[]) => void—
Returns
this
methodSince v0.0.0-alpha.2
emit(eventName: string | symbol, ...args: any[]): boolean;

Synchronously emit an event.

Parameters
NameTypeDescription
eventNamestring | symbol—
...argsany[]—
Returns
boolean
methodSince v0.0.0-alpha.2
[Symbol.asyncIterator](): AsyncIterableIterator<any>;

Iterate asynchronously over body chunks.

classSince v0.0.0-alpha.2vjs only
export class OutgoingMessage {
  readonly headersSent: boolean;
  sendDate: boolean;
  readonly req?: IncomingMessage;
  readonly writable: boolean;
  readonly writableEnded: boolean;
  readonly writableFinished: boolean;
  readonly destroyed: boolean;
  readonly closed: boolean;
  readonly errored: Error | null;
  constructor();
  appendHeader(name: string, value: OutgoingHttpHeader): this;
  flushHeaders(): void;
  getHeader(name: string): OutgoingHttpHeader | undefined;
  getHeaderNames(): string[];
  getHeaders(): OutgoingHttpHeaders;
  hasHeader(name: string): boolean;
  removeHeader(name: string): void;
  setHeader(name: string, value: OutgoingHttpHeader): this;
  setTimeout(msecs: number, callback?: () => void): this;
  addTrailers(headers: OutgoingHttpHeaders | ReadonlyArray<readonly [string, string]>): void;
  write(chunk: string | Uint8Array, callback?: (error?: Error | null) => void): boolean;
  write(chunk: string, encoding: string, callback?: (error?: Error | null) => void): boolean;
  end(callback?: () => void): this;
  end(chunk: string | Uint8Array, callback?: () => void): this;
  end(chunk: string, encoding: string, callback?: () => void): this;
  cork(): void;
  uncork(): void;
  destroy(error?: Error): this;
  on(eventName: string | symbol, listener: (...args: any[]) => void): this;
  once(eventName: string | symbol, listener: (...args: any[]) => void): this;
  off(eventName: string | symbol, listener: (...args: any[]) => void): this;
  emit(eventName: string | symbol, ...args: any[]): boolean;
}

Base class shared conceptually by ClientRequest and ServerResponse for managing outgoing HTTP headers and body streams.

Constructor
constructor();

Construct an OutgoingMessage.

Properties
PropertyTypeDescriptionSince
headersSent readonlybooleantrue once HTTP headers have been flushed to the wire.v0.0.0-alpha.2
sendDate booleanAutomatically emit a Date response header (default true).v0.0.0-alpha.2
req readonly optionalIncomingMessageAssociated IncomingMessage, when applicable.v0.0.0-alpha.2
writable readonlybooleanWhether the stream is currently writable.v0.0.0-alpha.2
writableEnded readonlybooleanWhether end() has been called.v0.0.0-alpha.2
writableFinished readonlybooleanWhether "finish" has been emitted.v0.0.0-alpha.2
destroyed readonlybooleanWhether destroy() has been called.v0.0.0-alpha.2
closed readonlybooleanWhether "close" has been emitted.v0.0.0-alpha.2
errored readonlyError | nullError passed to destroy(err), or null.v0.0.0-alpha.2
Methods
methodSince v0.0.0-alpha.2
appendHeader(name: string, value: OutgoingHttpHeader): this;

Append value to an existing outgoing header name.

Parameters
NameTypeDescription
namestring—
valueOutgoingHttpHeader—
Returns
this
methodSince v0.0.0-alpha.2
flushHeaders(): void;

Flush queued outgoing HTTP headers immediately.

Returns
void
methodSince v0.0.0-alpha.2
getHeader(name: string): OutgoingHttpHeader | undefined;

Retrieve the current value of outgoing header name.

Parameters
NameTypeDescription
namestring—
Returns
OutgoingHttpHeader | undefined
methodSince v0.0.0-alpha.2
getHeaderNames(): string[];

Return lowercased names of all queued outgoing headers.

Returns
string[]
methodSince v0.0.0-alpha.2
getHeaders(): OutgoingHttpHeaders;

Return a shallow copy of all queued outgoing headers.

methodSince v0.0.0-alpha.2
hasHeader(name: string): boolean;

Return true if outgoing header name has been set.

Parameters
NameTypeDescription
namestring—
Returns
boolean
methodSince v0.0.0-alpha.2
removeHeader(name: string): void;

Delete outgoing header name before headers are sent.

Parameters
NameTypeDescription
namestring—
Returns
void
methodSince v0.0.0-alpha.2
setHeader(name: string, value: OutgoingHttpHeader): this;

Set or overwrite outgoing header name.

Parameters
NameTypeDescription
namestring—
valueOutgoingHttpHeader—
Returns
this
methodSince v0.0.0-alpha.2
setTimeout(msecs: number, callback?: () => void): this;

Set socket inactivity timeout in milliseconds.

Parameters
NameTypeDescription
msecsnumber—
callback optional() => void—
Returns
this
methodSince v0.0.0-alpha.2
addTrailers(headers: OutgoingHttpHeaders | ReadonlyArray<readonly [string, string]>): void;

Add trailing HTTP headers sent after the chunked body.

Parameters
NameTypeDescription
headersOutgoingHttpHeaders | ReadonlyArray<readonly [string, string]>—
Returns
void
methodSince v0.0.0-alpha.2
write(chunk: string | Uint8Array, callback?: (error?: Error | null) => void): boolean;
write(chunk: string, encoding: string, callback?: (error?: Error | null) => void): boolean;

Write a body chunk.

Overload 1 — write(chunk, callback?)
NameTypeDescription
chunkstring | Uint8Array—
callback optional(error?: Error | null) => void—
boolean
Overload 2 — write(chunk, encoding, callback?)

Write a string body chunk with explicit encoding.

NameTypeDescription
chunkstring—
encodingstring—
callback optional(error?: Error | null) => void—
boolean
methodSince v0.0.0-alpha.2
end(callback?: () => void): this;
end(chunk: string | Uint8Array, callback?: () => void): this;
end(chunk: string, encoding: string, callback?: () => void): this;

Finish writing the HTTP message.

Overload 1 — end(callback?)
NameTypeDescription
callback optional() => void—
this
Overload 2 — end(chunk, callback?)

Write a final chunk and finish the HTTP message.

NameTypeDescription
chunkstring | Uint8Array—
callback optional() => void—
this
Overload 3 — end(chunk, encoding, callback?)

Write a final string chunk with encoding and finish the HTTP message.

NameTypeDescription
chunkstring—
encodingstring—
callback optional() => void—
this
methodSince v0.0.0-alpha.2
cork(): void;

Buffer subsequent writes in memory.

Returns
void
methodSince v0.0.0-alpha.2
uncork(): void;

Flush buffered writes.

Returns
void
methodSince v0.0.0-alpha.2
destroy(error?: Error): this;

Destroy the outgoing message stream.

Parameters
NameTypeDescription
error optionalError—
Returns
this
methodSince v0.0.0-alpha.2
on(eventName: string | symbol, listener: (...args: any[]) => void): this;

Register an event listener.

Parameters
NameTypeDescription
eventNamestring | symbol—
listener(...args: any[]) => void—
Returns
this
methodSince v0.0.0-alpha.2
once(eventName: string | symbol, listener: (...args: any[]) => void): this;

Register a one-time event listener.

Parameters
NameTypeDescription
eventNamestring | symbol—
listener(...args: any[]) => void—
Returns
this
methodSince v0.0.0-alpha.2
off(eventName: string | symbol, listener: (...args: any[]) => void): this;

Remove an event listener.

Parameters
NameTypeDescription
eventNamestring | symbol—
listener(...args: any[]) => void—
Returns
this
methodSince v0.0.0-alpha.2
emit(eventName: string | symbol, ...args: any[]): boolean;

Synchronously emit an event.

Parameters
NameTypeDescription
eventNamestring | symbol—
...argsany[]—
Returns
boolean
classSince v0.0.0-alpha.2vjs only
export class ServerResponse {
  statusCode: number;
  statusMessage: string;
  readonly req: IncomingMessage;
  readonly headersSent: boolean;
  sendDate: boolean;
  strictContentLength: boolean;
  readonly writable: boolean;
  readonly writableEnded: boolean;
  readonly writableFinished: boolean;
  readonly destroyed: boolean;
  constructor(req: IncomingMessage);
  writeHead(
      statusCode: number,
      statusMessage?: string,
      headers?: OutgoingHttpHeaders | ReadonlyArray<string>,
    ): this;
  writeHead(
      statusCode: number,
      headers?: OutgoingHttpHeaders | ReadonlyArray<string>,
    ): this;
  writeContinue(callback?: () => void): void;
  writeEarlyHints(hints: Record<string, string | string[]>, callback?: () => void): void;
  writeProcessing(): void;
  appendHeader(name: string, value: OutgoingHttpHeader): this;
  flushHeaders(): void;
  getHeader(name: string): OutgoingHttpHeader | undefined;
  getHeaderNames(): string[];
  getHeaders(): OutgoingHttpHeaders;
  hasHeader(name: string): boolean;
  removeHeader(name: string): void;
  setHeader(name: string, value: OutgoingHttpHeader): this;
  addTrailers(headers: OutgoingHttpHeaders | ReadonlyArray<readonly [string, string]>): void;
  setTimeout(msecs: number, callback?: () => void): this;
  write(chunk: string | Uint8Array, callback?: (error?: Error | null) => void): boolean;
  write(chunk: string, encoding: string, callback?: (error?: Error | null) => void): boolean;
  end(callback?: () => void): this;
  end(chunk: string | Uint8Array, callback?: () => void): this;
  end(chunk: string, encoding: string, callback?: () => void): this;
  cork(): void;
  uncork(): void;
  destroy(error?: Error): this;
  on(eventName: string | symbol, listener: (...args: any[]) => void): this;
  once(eventName: string | symbol, listener: (...args: any[]) => void): this;
  off(eventName: string | symbol, listener: (...args: any[]) => void): this;
  emit(eventName: string | symbol, ...args: any[]): boolean;
}

Writable server response object passed as the second argument to RequestListener.

Constructor
constructor(req: IncomingMessage);

Construct a ServerResponse bound to req.

Parameters
NameTypeDescription
reqIncomingMessageAssociated IncomingMessage.
Properties
PropertyTypeDescriptionSince
statusCode numberHTTP status code (default 200).v0.0.0-alpha.2
statusMessage stringHTTP status reason phrase.v0.0.0-alpha.2
req readonlyIncomingMessageAssociated incoming request.v0.0.0-alpha.2
headersSent readonlybooleantrue once response headers have been sent.v0.0.0-alpha.2
sendDate booleanAutomatically include a Date header (default true).v0.0.0-alpha.2
strictContentLength booleanEnforce strict Content-Length byte counting.v0.0.0-alpha.2
writable readonlybooleanWhether the response stream is writable.v0.0.0-alpha.2
writableEnded readonlybooleanWhether end() has been called.v0.0.0-alpha.2
writableFinished readonlybooleanWhether "finish" has been emitted.v0.0.0-alpha.2
destroyed readonlybooleanWhether destroy() has been called.v0.0.0-alpha.2
Methods
methodSince v0.0.0-alpha.2
writeHead(
  statusCode: number,
  statusMessage?: string,
  headers?: OutgoingHttpHeaders | ReadonlyArray<string>,
): this;
writeHead(
  statusCode: number,
  headers?: OutgoingHttpHeaders | ReadonlyArray<string>,
): this;

Write status code, optional reason message, and response headers.

Overload 1 — writeHead(statusCode, statusMessage?, headers?)
NameTypeDescription
statusCodenumber—
statusMessage optionalstring—
headers optionalOutgoingHttpHeaders | ReadonlyArray<string>—
this
Overload 2 — writeHead(statusCode, headers?)

Write status code and response headers.

NameTypeDescription
statusCodenumber—
headers optionalOutgoingHttpHeaders | ReadonlyArray<string>—
this
methodSince v0.0.0-alpha.2
writeContinue(callback?: () => void): void;

Send an HTTP 100 Continue interim response.

Parameters
NameTypeDescription
callback optional() => void—
Returns
void
methodSince v0.0.0-alpha.2
writeEarlyHints(hints: Record<string, string | string[]>, callback?: () => void): void;

Send an HTTP 103 Early Hints interim response.

Parameters
NameTypeDescription
hintsRecord<string, string | string[]>—
callback optional() => void—
Returns
void
methodSince v0.0.0-alpha.2
writeProcessing(): void;

Send an HTTP 102 Processing interim response.

Returns
void
methodSince v0.0.0-alpha.2
appendHeader(name: string, value: OutgoingHttpHeader): this;

Append value to an existing response header name.

Parameters
NameTypeDescription
namestring—
valueOutgoingHttpHeader—
Returns
this
methodSince v0.0.0-alpha.2
flushHeaders(): void;

Flush queued response headers immediately.

Returns
void
methodSince v0.0.0-alpha.2
getHeader(name: string): OutgoingHttpHeader | undefined;

Retrieve response header name.

Parameters
NameTypeDescription
namestring—
Returns
OutgoingHttpHeader | undefined
methodSince v0.0.0-alpha.2
getHeaderNames(): string[];

Return lowercased names of all queued response headers.

Returns
string[]
methodSince v0.0.0-alpha.2
getHeaders(): OutgoingHttpHeaders;

Return a shallow copy of all queued response headers.

methodSince v0.0.0-alpha.2
hasHeader(name: string): boolean;

Return true if response header name has been set.

Parameters
NameTypeDescription
namestring—
Returns
boolean
methodSince v0.0.0-alpha.2
removeHeader(name: string): void;

Delete response header name.

Parameters
NameTypeDescription
namestring—
Returns
void
methodSince v0.0.0-alpha.2
setHeader(name: string, value: OutgoingHttpHeader): this;

Set or overwrite response header name.

Parameters
NameTypeDescription
namestring—
valueOutgoingHttpHeader—
Returns
this
methodSince v0.0.0-alpha.2
addTrailers(headers: OutgoingHttpHeaders | ReadonlyArray<readonly [string, string]>): void;

Add trailing response headers.

Parameters
NameTypeDescription
headersOutgoingHttpHeaders | ReadonlyArray<readonly [string, string]>—
Returns
void
methodSince v0.0.0-alpha.2
setTimeout(msecs: number, callback?: () => void): this;

Set socket inactivity timeout in milliseconds.

Parameters
NameTypeDescription
msecsnumber—
callback optional() => void—
Returns
this
methodSince v0.0.0-alpha.2
write(chunk: string | Uint8Array, callback?: (error?: Error | null) => void): boolean;
write(chunk: string, encoding: string, callback?: (error?: Error | null) => void): boolean;

Write a response body chunk.

Overload 1 — write(chunk, callback?)
NameTypeDescription
chunkstring | Uint8Array—
callback optional(error?: Error | null) => void—
boolean
Overload 2 — write(chunk, encoding, callback?)

Write a response string chunk with explicit encoding.

NameTypeDescription
chunkstring—
encodingstring—
callback optional(error?: Error | null) => void—
boolean
methodSince v0.0.0-alpha.2
end(callback?: () => void): this;
end(chunk: string | Uint8Array, callback?: () => void): this;
end(chunk: string, encoding: string, callback?: () => void): this;

Finish sending the HTTP response.

Overload 1 — end(callback?)
NameTypeDescription
callback optional() => void—
this
Overload 2 — end(chunk, callback?)

Write a final chunk and finish the HTTP response.

NameTypeDescription
chunkstring | Uint8Array—
callback optional() => void—
this
Overload 3 — end(chunk, encoding, callback?)

Write a final string chunk with encoding and finish the HTTP response.

NameTypeDescription
chunkstring—
encodingstring—
callback optional() => void—
this
methodSince v0.0.0-alpha.2
cork(): void;

Buffer subsequent response writes.

Returns
void
methodSince v0.0.0-alpha.2
uncork(): void;

Flush buffered response writes.

Returns
void
methodSince v0.0.0-alpha.2
destroy(error?: Error): this;

Destroy the response stream.

Parameters
NameTypeDescription
error optionalError—
Returns
this
methodSince v0.0.0-alpha.2
on(eventName: string | symbol, listener: (...args: any[]) => void): this;

Register an event listener.

Parameters
NameTypeDescription
eventNamestring | symbol—
listener(...args: any[]) => void—
Returns
this
methodSince v0.0.0-alpha.2
once(eventName: string | symbol, listener: (...args: any[]) => void): this;

Register a one-time event listener.

Parameters
NameTypeDescription
eventNamestring | symbol—
listener(...args: any[]) => void—
Returns
this
methodSince v0.0.0-alpha.2
off(eventName: string | symbol, listener: (...args: any[]) => void): this;

Remove an event listener.

Parameters
NameTypeDescription
eventNamestring | symbol—
listener(...args: any[]) => void—
Returns
this
methodSince v0.0.0-alpha.2
emit(eventName: string | symbol, ...args: any[]): boolean;

Synchronously emit an event.

Parameters
NameTypeDescription
eventNamestring | symbol—
...argsany[]—
Returns
boolean
classSince v0.0.0-alpha.2vjs only
export class ClientRequest {
  readonly aborted: boolean;
  readonly destroyed: boolean;
  readonly method: string;
  path: string;
  readonly host: string;
  readonly protocol: string;
  readonly reusedSocket: boolean;
  maxHeadersCount: number;
  readonly headersSent: boolean;
  readonly writable: boolean;
  readonly writableEnded: boolean;
  readonly writableFinished: boolean;
  constructor(
      options: string | import("node:url").URL | RequestOptions,
      cb?: (res: IncomingMessage) => void,
    );
  abort(): void;
  flushHeaders(): void;
  getHeader(name: string): OutgoingHttpHeader | undefined;
  getHeaderNames(): string[];
  getHeaders(): OutgoingHttpHeaders;
  getRawHeaderNames(): string[];
  hasHeader(name: string): boolean;
  removeHeader(name: string): void;
  setHeader(name: string, value: OutgoingHttpHeader): this;
  setNoDelay(noDelay?: boolean): void;
  setSocketKeepAlive(enable?: boolean, initialDelay?: number): void;
  setTimeout(timeout: number, callback?: () => void): this;
  write(chunk: string | Uint8Array, callback?: (error?: Error | null) => void): boolean;
  write(chunk: string, encoding: string, callback?: (error?: Error | null) => void): boolean;
  end(callback?: () => void): this;
  end(chunk: string | Uint8Array, callback?: () => void): this;
  end(chunk: string, encoding: string, callback?: () => void): this;
  destroy(error?: Error): this;
  on(eventName: string | symbol, listener: (...args: any[]) => void): this;
  once(eventName: string | symbol, listener: (...args: any[]) => void): this;
  off(eventName: string | symbol, listener: (...args: any[]) => void): this;
  emit(eventName: string | symbol, ...args: any[]): boolean;
}

Outgoing client HTTP request returned by request() and get().

Constructor
constructor(
  options: string | import("node:url").URL | RequestOptions,
  cb?: (res: IncomingMessage) => void,
);

Construct a ClientRequest.

Parameters
NameTypeDescription
optionsstring | import("node:url").URL | RequestOptionsRequest URL or options object.
cb optional(res: IncomingMessage) => voidOptional "response" event listener.
Properties
PropertyTypeDescriptionSince
aborted readonlybooleantrue if the request has been aborted.v0.0.0-alpha.2
destroyed readonlybooleantrue if destroy() has been called.v0.0.0-alpha.2
method readonlystringHTTP method string ("GET", "POST", etc.).v0.0.0-alpha.2
path stringRequest path and query string.v0.0.0-alpha.2
host readonlystringTarget host name.v0.0.0-alpha.2
protocol readonlystringRequest protocol scheme ("http:").v0.0.0-alpha.2
reusedSocket readonlybooleantrue when sent over a reused keep-alive socket.v0.0.0-alpha.2
maxHeadersCount numberMaximum response header count accepted.v0.0.0-alpha.2
headersSent readonlybooleantrue once request headers have been sent.v0.0.0-alpha.2
writable readonlybooleanWhether the request stream is writable.v0.0.0-alpha.2
writableEnded readonlybooleanWhether end() has been called.v0.0.0-alpha.2
writableFinished readonlybooleanWhether "finish" has been emitted.v0.0.0-alpha.2
Methods
methodSince v0.0.0-alpha.2
abort(): void;

Abort the in-flight request.

Returns
void
methodSince v0.0.0-alpha.2
flushHeaders(): void;

Flush queued request headers immediately.

Returns
void
methodSince v0.0.0-alpha.2
getHeader(name: string): OutgoingHttpHeader | undefined;

Retrieve request header name.

Parameters
NameTypeDescription
namestring—
Returns
OutgoingHttpHeader | undefined
methodSince v0.0.0-alpha.2
getHeaderNames(): string[];

Return lowercased names of all queued request headers.

Returns
string[]
methodSince v0.0.0-alpha.2
getHeaders(): OutgoingHttpHeaders;

Return a shallow copy of all queued request headers.

methodSince v0.0.0-alpha.2
getRawHeaderNames(): string[];

Return header names in their original casing.

Returns
string[]
methodSince v0.0.0-alpha.2
hasHeader(name: string): boolean;

Return true if request header name is set.

Parameters
NameTypeDescription
namestring—
Returns
boolean
methodSince v0.0.0-alpha.2
removeHeader(name: string): void;

Delete request header name.

Parameters
NameTypeDescription
namestring—
Returns
void
methodSince v0.0.0-alpha.2
setHeader(name: string, value: OutgoingHttpHeader): this;

Set or overwrite request header name.

Parameters
NameTypeDescription
namestring—
valueOutgoingHttpHeader—
Returns
this
methodSince v0.0.0-alpha.2
setNoDelay(noDelay?: boolean): void;

Configure TCP_NODELAY on the underlying socket.

Parameters
NameTypeDescription
noDelay optionalboolean—
Returns
void
methodSince v0.0.0-alpha.2
setSocketKeepAlive(enable?: boolean, initialDelay?: number): void;

Configure TCP keep-alive on the underlying socket.

Parameters
NameTypeDescription
enable optionalboolean—
initialDelay optionalnumber—
Returns
void
methodSince v0.0.0-alpha.2
setTimeout(timeout: number, callback?: () => void): this;

Set inactivity timeout in milliseconds.

Parameters
NameTypeDescription
timeoutnumber—
callback optional() => void—
Returns
this
methodSince v0.0.0-alpha.2
write(chunk: string | Uint8Array, callback?: (error?: Error | null) => void): boolean;
write(chunk: string, encoding: string, callback?: (error?: Error | null) => void): boolean;

Write a request body chunk.

Overload 1 — write(chunk, callback?)
NameTypeDescription
chunkstring | Uint8Array—
callback optional(error?: Error | null) => void—
boolean
Overload 2 — write(chunk, encoding, callback?)

Write a request string chunk with explicit encoding.

NameTypeDescription
chunkstring—
encodingstring—
callback optional(error?: Error | null) => void—
boolean
methodSince v0.0.0-alpha.2
end(callback?: () => void): this;
end(chunk: string | Uint8Array, callback?: () => void): this;
end(chunk: string, encoding: string, callback?: () => void): this;

Finish sending the HTTP request.

Overload 1 — end(callback?)
NameTypeDescription
callback optional() => void—
this
Overload 2 — end(chunk, callback?)

Write a final chunk and finish sending the HTTP request.

NameTypeDescription
chunkstring | Uint8Array—
callback optional() => void—
this
Overload 3 — end(chunk, encoding, callback?)

Write a final string chunk with encoding and finish the HTTP request.

NameTypeDescription
chunkstring—
encodingstring—
callback optional() => void—
this
methodSince v0.0.0-alpha.2
destroy(error?: Error): this;

Destroy the request stream.

Parameters
NameTypeDescription
error optionalError—
Returns
this
methodSince v0.0.0-alpha.2
on(eventName: string | symbol, listener: (...args: any[]) => void): this;

Register an event listener.

Parameters
NameTypeDescription
eventNamestring | symbol—
listener(...args: any[]) => void—
Returns
this
methodSince v0.0.0-alpha.2
once(eventName: string | symbol, listener: (...args: any[]) => void): this;

Register a one-time event listener.

Parameters
NameTypeDescription
eventNamestring | symbol—
listener(...args: any[]) => void—
Returns
this
methodSince v0.0.0-alpha.2
off(eventName: string | symbol, listener: (...args: any[]) => void): this;

Remove an event listener.

Parameters
NameTypeDescription
eventNamestring | symbol—
listener(...args: any[]) => void—
Returns
this
methodSince v0.0.0-alpha.2
emit(eventName: string | symbol, ...args: any[]): boolean;

Synchronously emit an event.

Parameters
NameTypeDescription
eventNamestring | symbol—
...argsany[]—
Returns
boolean
classSince v0.0.0-alpha.2vjs only
export class Server {
  readonly listening: boolean;
  headersTimeout: number;
  keepAliveTimeout: number;
  maxHeadersCount: number | null;
  maxRequestsPerSocket: number | null;
  requestTimeout: number;
  timeout: number;
  constructor(requestListener?: RequestListener);
  constructor(options: ServerOptions, requestListener?: RequestListener);
  listen(port?: number, hostname?: string, listeningListener?: () => void): this;
  listen(port?: number, listeningListener?: () => void): this;
  listen(
      options: { port?: number; host?: string; backlog?: number; path?: string },
      listeningListener?: () => void,
    ): this;
  close(callback?: (err?: Error) => void): this;
  closeAllConnections(): void;
  closeIdleConnections(): void;
  setTimeout(msecs?: number, callback?: () => void): this;
  address(): { address: string; family: string; port: number } | string | null;
  ref(): this;
  unref(): this;
  on(eventName: string | symbol, listener: (...args: any[]) => void): this;
  once(eventName: string | symbol, listener: (...args: any[]) => void): this;
  off(eventName: string | symbol, listener: (...args: any[]) => void): this;
  emit(eventName: string | symbol, ...args: any[]): boolean;
  [Symbol.asyncDispose](): Promise<void>;
}

HTTP/1.1 server instance returned by createServer().

Constructor
constructor(requestListener?: RequestListener);
constructor(options: ServerOptions, requestListener?: RequestListener);

Construct an HTTP Server with an optional "request" listener.

Overload 1 — new Server(requestListener?)
NameTypeDescription
requestListener optionalRequestListenerCallback invoked for each HTTP request.
Overload 2 — new Server(options, requestListener?)

Construct an HTTP Server with explicit options and optional listener.

NameTypeDescription
optionsServerOptionsServer configuration.
requestListener optionalRequestListenerCallback invoked for each HTTP request.
Properties
PropertyTypeDescriptionSince
listening readonlybooleantrue while the server is listening for connections.v0.0.0-alpha.2
headersTimeout numberMaximum milliseconds to wait for incoming headers (default 60000).v0.0.0-alpha.2
keepAliveTimeout numberKeep-alive timeout in milliseconds (default 5000).v0.0.0-alpha.2
maxHeadersCount number | nullMaximum number of headers parsed per request.v0.0.0-alpha.2
maxRequestsPerSocket number | nullMaximum requests handled per keep-alive socket.v0.0.0-alpha.2
requestTimeout numberRequest timeout in milliseconds (default 300000).v0.0.0-alpha.2
timeout numberInactivity socket timeout in milliseconds (0 disables).v0.0.0-alpha.2
Methods
methodSince v0.0.0-alpha.2
listen(port?: number, hostname?: string, listeningListener?: () => void): this;
listen(port?: number, listeningListener?: () => void): this;
listen(
  options: { port?: number; host?: string; backlog?: number; path?: string },
  listeningListener?: () => void,
): this;

Start listening for HTTP connections on port.

Overload 1 — listen(port?, hostname?, listeningListener?)
NameTypeDescription
port optionalnumber—
hostname optionalstring—
listeningListener optional() => void—
this
Overload 2 — listen(port?, listeningListener?)

Start listening on port with optional listener.

NameTypeDescription
port optionalnumber—
listeningListener optional() => void—
this
Overload 3 — listen(options, listeningListener?)

Start listening using explicit options.

NameTypeDescription
options{ port?: number; host?: string; backlog?: number; path?: string }—
listeningListener optional() => void—
this
methodSince v0.0.0-alpha.2
close(callback?: (err?: Error) => void): this;

Stop accepting new connections and close once active requests finish.

Parameters
NameTypeDescription
callback optional(err?: Error) => void—
Returns
this
methodSince v0.0.0-alpha.2
closeAllConnections(): void;

Immediately close all connected sockets.

Returns
void
methodSince v0.0.0-alpha.2
closeIdleConnections(): void;

Close all idle keep-alive sockets not currently handling a request.

Returns
void
methodSince v0.0.0-alpha.2
setTimeout(msecs?: number, callback?: () => void): this;

Set default socket inactivity timeout and optional "timeout" listener.

Parameters
NameTypeDescription
msecs optionalnumber—
callback optional() => void—
Returns
this
methodSince v0.0.0-alpha.2
address(): { address: string; family: string; port: number } | string | null;

Return bound local address metadata or null.

Returns
{ address: string; family: string; port: number } | string | null
methodSince v0.0.0-alpha.2
ref(): this;

Keep the event loop active while listening.

Returns
this
methodSince v0.0.0-alpha.2
unref(): this;

Allow the event loop to exit if the server is the only active handle.

Returns
this
methodSince v0.0.0-alpha.2
on(eventName: string | symbol, listener: (...args: any[]) => void): this;

Register an event listener.

Parameters
NameTypeDescription
eventNamestring | symbol—
listener(...args: any[]) => void—
Returns
this
methodSince v0.0.0-alpha.2
once(eventName: string | symbol, listener: (...args: any[]) => void): this;

Register a one-time event listener.

Parameters
NameTypeDescription
eventNamestring | symbol—
listener(...args: any[]) => void—
Returns
this
methodSince v0.0.0-alpha.2
off(eventName: string | symbol, listener: (...args: any[]) => void): this;

Remove an event listener.

Parameters
NameTypeDescription
eventNamestring | symbol—
listener(...args: any[]) => void—
Returns
this
methodSince v0.0.0-alpha.2
emit(eventName: string | symbol, ...args: any[]): boolean;

Synchronously emit an event.

Parameters
NameTypeDescription
eventNamestring | symbol—
...argsany[]—
Returns
boolean
methodSince v0.0.0-alpha.2
[Symbol.asyncDispose](): Promise<void>;

Close the server asynchronously when disposed via await using.

Returns
Promise<void>
interfaceSince v0.0.0-alpha.2vjs only
export interface AbortSignalLike {
  readonly aborted: boolean;
  readonly reason?: unknown;
  addEventListener(type: string, listener: (...args: any[]) => void, options?: { once?: boolean }): void;
  removeEventListener?(type: string, listener: (...args: any[]) => void): void;
}

Minimal abort-signal contract accepted by HTTP request and server options.

Properties
PropertyTypeDescriptionSince
aborted readonlybooleanWhether the signal has already been aborted.v0.0.0-alpha.2
reason readonly optionalunknownOptional abort reason value.v0.0.0-alpha.2
Methods
methodSince v0.0.0-alpha.2
addEventListener(type: string, listener: (...args: any[]) => void, options?: { once?: boolean }): void;

Register an "abort" listener.

Parameters
NameTypeDescription
typestring—
listener(...args: any[]) => void—
options optional{ once?: boolean }—
Returns
void
methodSince v0.0.0-alpha.2
removeEventListener?(type: string, listener: (...args: any[]) => void): void;

Unregister an "abort" listener.

Parameters
NameTypeDescription
typestring—
listener(...args: any[]) => void—
Returns
void
interfaceSince v0.0.0-alpha.2vjs only
export interface AgentOptions {
  keepAlive?: boolean;
  keepAliveMsecs?: number;
  maxSockets?: number;
  maxTotalSockets?: number;
  maxFreeSockets?: number;
  timeout?: number;
  scheduling?: "fifo" | "lifo";
}

Options accepted by new Agent(options).

Properties
PropertyTypeDescriptionSince
keepAlive optionalbooleanReuse idle TCP connections across requests (default false).v0.0.0-alpha.2
keepAliveMsecs optionalnumberKeep-alive probe initial delay in milliseconds.v0.0.0-alpha.2
maxSockets optionalnumberMaximum concurrent sockets per host (default Infinity).v0.0.0-alpha.2
maxTotalSockets optionalnumberMaximum total concurrent sockets across all hosts.v0.0.0-alpha.2
maxFreeSockets optionalnumberMaximum idle sockets kept open per host when keepAlive is enabled.v0.0.0-alpha.2
timeout optionalnumberDefault socket timeout in milliseconds.v0.0.0-alpha.2
scheduling optional"fifo" | "lifo"Scheduling strategy for idle socket reuse ("fifo" or "lifo").v0.0.0-alpha.2
interfaceSince v0.0.0-alpha.2vjs only
export interface RequestOptions {
  protocol?: string | null;
  host?: string | null;
  hostname?: string | null;
  family?: number;
  port?: number | string | null;
  localAddress?: string;
  socketPath?: string;
  method?: string;
  path?: string | null;
  headers?: OutgoingHttpHeaders;
  auth?: string | null;
  agent?: Agent | boolean;
  timeout?: number;
  signal?: AbortSignalLike;
  setHost?: boolean;
}

Options accepted by request(), get(), and new ClientRequest().

Properties
PropertyTypeDescriptionSince
protocol optionalstring | nullURL protocol scheme ("http:").v0.0.0-alpha.2
host optionalstring | nullTarget host or IP address.v0.0.0-alpha.2
hostname optionalstring | nullTarget hostname (preferred over host).v0.0.0-alpha.2
family optionalnumberIP address family (4 or 6).v0.0.0-alpha.2
port optionalnumber | string | nullTarget TCP port.v0.0.0-alpha.2
localAddress optionalstringLocal interface IP to bind for outgoing sockets.v0.0.0-alpha.2
socketPath optionalstringUnix domain socket path.v0.0.0-alpha.2
method optionalstringHTTP method ("GET", "POST", etc.).v0.0.0-alpha.2
path optionalstring | nullRequest path and query string (default "/").v0.0.0-alpha.2
headers optionalOutgoingHttpHeadersOutgoing HTTP headers.v0.0.0-alpha.2
auth optionalstring | nullBasic authentication "user:password" string.v0.0.0-alpha.2
agent optionalAgent | booleanConnection-pooling Agent, or false to bypass pooling.v0.0.0-alpha.2
timeout optionalnumberSocket inactivity timeout in milliseconds.v0.0.0-alpha.2
signal optionalAbortSignalLikeOptional abort signal cancelling the in-flight request.v0.0.0-alpha.2
setHost optionalbooleanSet the Host header automatically (default true).v0.0.0-alpha.2
interfaceSince v0.0.0-alpha.2vjs only
export interface ServerOptions {
  IncomingMessage?: typeof IncomingMessage;
  ServerResponse?: typeof ServerResponse;
  keepAliveTimeout?: number;
  headersTimeout?: number;
  requestTimeout?: number;
  maxHeaderSize?: number;
  requireHostHeader?: boolean;
  noDelay?: boolean;
  keepAlive?: boolean;
  keepAliveInitialDelay?: number;
}

Options accepted by createServer() and new Server().

Properties
PropertyTypeDescriptionSince
IncomingMessage optionaltypeof IncomingMessageCustom IncomingMessage subclass constructor.v0.0.0-alpha.2
ServerResponse optionaltypeof ServerResponseCustom ServerResponse subclass constructor.v0.0.0-alpha.2
keepAliveTimeout optionalnumberKeep-alive idle socket timeout in milliseconds (default 5000).v0.0.0-alpha.2
headersTimeout optionalnumberMaximum milliseconds to receive complete request headers.v0.0.0-alpha.2
requestTimeout optionalnumberMaximum milliseconds for an entire incoming request.v0.0.0-alpha.2
maxHeaderSize optionalnumberMaximum HTTP header block size in bytes.v0.0.0-alpha.2
requireHostHeader optionalbooleanReject requests missing a Host header on HTTP/1.1.v0.0.0-alpha.2
noDelay optionalbooleanDisable Nagle's algorithm (TCP_NODELAY).v0.0.0-alpha.2
keepAlive optionalbooleanEnable TCP keep-alive probes.v0.0.0-alpha.2
keepAliveInitialDelay optionalnumberInitial TCP keep-alive delay in milliseconds.v0.0.0-alpha.2
typeSince v0.0.0-alpha.2vjs only
export type IncomingHttpHeaders = Record<string, string | string[] | undefined>;

Parsed HTTP header map for incoming requests and responses.

typeSince v0.0.0-alpha.2vjs only
export type OutgoingHttpHeader = number | string | readonly string[];

Value accepted for an outgoing HTTP header.

typeSince v0.0.0-alpha.2vjs only
export type OutgoingHttpHeaders = Record<string, OutgoingHttpHeader | undefined>;

Outgoing HTTP header dictionary keyed by header name.

typeSince v0.0.0-alpha.2vjs only
export type RequestListener = (req: IncomingMessage, res: ServerResponse) => void;

Callback invoked for each incoming HTTP request on a Server.

constSince v0.0.0-alpha.2vjs only
export const METHODS: readonly string[];

List of HTTP methods supported by the HTTP parser, sorted alphabetically.

constSince v0.0.0-alpha.2vjs only
export const STATUS_CODES: Record<number | string, string | undefined>;

Mapping from HTTP status codes (for example 200, 404) to standard reason phrases (for example "OK", "Not Found").

constSince v0.0.0-alpha.2vjs only
export const globalAgent: Agent;

Default global HTTP Agent used when no custom agent is supplied.

constSince v0.0.0-alpha.2vjs only
export const maxHeaderSize: number;

Maximum HTTP header block size in bytes (default 16384).

defaultSince v0.0.0-alpha.2vjs only
const _default: {
  /** `Agent` constructor. @since 0.0.0-alpha.2 */
  Agent: typeof Agent;
  /** `ClientRequest` constructor. @since 0.0.0-alpha.2 */
  ClientRequest: typeof ClientRequest;
  /** `IncomingMessage` constructor. @since 0.0.0-alpha.2 */
  IncomingMessage: typeof IncomingMessage;
  /** Supported HTTP methods list. @since 0.0.0-alpha.2 */
  readonly METHODS: readonly string[];
  /** `OutgoingMessage` constructor. @since 0.0.0-alpha.2 */
  OutgoingMessage: typeof OutgoingMessage;
  /** HTTP status code reason phrases map. @since 0.0.0-alpha.2 */
  readonly STATUS_CODES: Record<number | string, string | undefined>;
  /** `Server` constructor. @since 0.0.0-alpha.2 */
  Server: typeof Server;
  /** `ServerResponse` constructor. @since 0.0.0-alpha.2 */
  ServerResponse: typeof ServerResponse;
  /** Create an HTTP server. @since 0.0.0-alpha.2 */
  createServer: typeof createServer;
  /** Issue a GET request. @since 0.0.0-alpha.2 */
  get: typeof get;
  /** Default global HTTP `Agent`. @since 0.0.0-alpha.2 */
  readonly globalAgent: Agent;
  /** Default max HTTP header size in bytes. @since 0.0.0-alpha.2 */
  readonly maxHeaderSize: number;
  /** Issue an HTTP request. @since 0.0.0-alpha.2 */
  request: typeof request;
  /** Validate an HTTP header name. @since 0.0.0-alpha.2 */
  validateHeaderName: typeof validateHeaderName;
  /** Validate an HTTP header value. @since 0.0.0-alpha.2 */
  validateHeaderValue: typeof validateHeaderValue;
};
export default _default;

Default export object providing the node:http API.