Spec-Zone.ru › Deno 2

http2

The node:http2 module provides an implementation of the HTTP/2 protocol. It can be accessed using:

import http2 from 'node:http2';

Usage in Deno

import * as mod from "node:http2";

class Http2ServerRequest

extends stream.Readable

Usage in Deno

import { Http2ServerRequest } from "node:http2";

A Http2ServerRequest object is created by Server or SecureServer and passed as the first argument to the 'request' event. It may be used to access a request status, headers, and data.

Constructors

Http2ServerRequest(
stream: ServerHttp2Stream,
headers: IncomingHttpHeaders,
options: stream.ReadableOptions,
rawHeaders: readonly string[],
)
new

Properties

aborted: boolean
readonly

The request.aborted property will be true if the request has been aborted.

authority: string
readonly

The request authority pseudo header field. Because HTTP/2 allows requests to set either :authority or host, this value is derived from req.headers[':authority'] if present. Otherwise, it is derived from req.headers['host'].

complete: boolean
readonly

The request.complete property will be true if the request has been completed, aborted, or destroyed.

connection: net.Socket | tls.TLSSocket
deprecated
readonly

See request.socket.

headers: IncomingHttpHeaders
readonly

The request/response headers object.

Key-value pairs of header names and values. Header names are lower-cased.

// Prints something like:
//
// { 'user-agent': 'curl/7.22.0',
//   host: '127.0.0.1:8000',
//   accept: '*' }
console.log(request.headers);

See HTTP/2 Headers Object.

In HTTP/2, the request path, host name, protocol, and method are represented as special headers prefixed with the : character (e.g. ':path'). These special headers will be included in the request.headers object. Care must be taken not to inadvertently modify these special headers or errors may occur. For instance, removing all headers from the request will cause errors to occur:

removeAllHeaders(request.headers);
assert(request.url);   // Fails because the :path header has been removed
httpVersion: string
readonly

In case of server request, the HTTP version sent by the client. In the case of client response, the HTTP version of the connected-to server. Returns '2.0'.

Also message.httpVersionMajor is the first integer and message.httpVersionMinor is the second.

httpVersionMajor: number
readonly
httpVersionMinor: number
readonly
method: string
readonly

The request method as a string. Read-only. Examples: 'GET', 'DELETE'.

rawHeaders: string[]
readonly

The raw request/response headers list exactly as they were received.

The keys and values are in the same list. It is not a list of tuples. So, the even-numbered offsets are key values, and the odd-numbered offsets are the associated values.

Header names are not lowercased, and duplicates are not merged.

// Prints something like:
//
// [ 'user-agent',
//   'this is invalid because there can be only one',
//   'User-Agent',
//   'curl/7.22.0',
//   'Host',
//   '127.0.0.1:8000',
//   'ACCEPT',
//   '*' ]
console.log(request.rawHeaders);
rawTrailers: string[]
readonly

The raw request/response trailer keys and values exactly as they were received. Only populated at the 'end' event.

scheme: string
readonly

The request scheme pseudo header field indicating the scheme portion of the target URL.

socket: net.Socket | tls.TLSSocket
readonly

Returns a Proxy object that acts as a net.Socket (or tls.TLSSocket) but applies getters, setters, and methods based on HTTP/2 logic.

destroyed, readable, and writable properties will be retrieved from and set on request.stream.

destroy, emit, end, on and once methods will be called on request.stream.

setTimeout method will be called on request.stream.session.

pause, read, resume, and write will throw an error with code ERR_HTTP2_NO_SOCKET_MANIPULATION. See Http2Session and Sockets for more information.

All other interactions will be routed directly to the socket. With TLS support, use request.socket.getPeerCertificate() to obtain the client's authentication details.

stream: ServerHttp2Stream
readonly

The Http2Stream object backing the request.

trailers: IncomingHttpHeaders
readonly

The request/response trailers object. Only populated at the 'end' event.

url: string

Request URL string. This contains only the URL that is present in the actual HTTP request. If the request is:

GET /status?name=ryan HTTP/1.1
Accept: text/plain

Then request.url will be:

'/status?name=ryan'

To parse the url into its parts, new URL() can be used:

$ node
> new URL('/status?name=ryan', 'http://example.com')
URL {
  href: 'http://example.com/status?name=ryan',
  origin: 'http://example.com',
  protocol: 'http:',
  username: '',
  password: '',
  host: 'example.com',
  hostname: 'example.com',
  port: '',
  pathname: '/status',
  search: '?name=ryan',
  searchParams: URLSearchParams { 'name' => 'ryan' },
  hash: ''
}

Methods

addListener(
event: "aborted",
listener: (
hadError: boolean,
code: number,
) => void
,
): this
addListener(
event: "close",
listener: () => void,
): this
addListener(
event: "data",
listener: (chunk: Buffer | string) => void,
): this
addListener(
event: "end",
listener: () => void,
): this
addListener(
event: "readable",
listener: () => void,
): this
addListener(
event: "error",
listener: (err: Error) => void,
): this
addListener(
event: string | symbol,
listener: (...args: any[]) => void,
): this
emit(
event: "aborted",
hadError: boolean,
code: number,
): boolean
emit(event: "close"): boolean
emit(
event: "data",
chunk: Buffer | string,
): boolean
emit(event: "end"): boolean
emit(event: "readable"): boolean
emit(
event: "error",
err: Error,
): boolean
emit(
event: string | symbol,
...args: any[],
): boolean
on(
event: "aborted",
listener: (
hadError: boolean,
code: number,
) => void
,
): this
on(
event: "close",
listener: () => void,
): this
on(
event: "data",
listener: (chunk: Buffer | string) => void,
): this
on(
event: "end",
listener: () => void,
): this
on(
event: "readable",
listener: () => void,
): this
on(
event: "error",
listener: (err: Error) => void,
): this
on(
event: string | symbol,
listener: (...args: any[]) => void,
): this
once(
event: "aborted",
listener: (
hadError: boolean,
code: number,
) => void
,
): this
once(
event: "close",
listener: () => void,
): this
once(
event: "data",
listener: (chunk: Buffer | string) => void,
): this
once(
event: "end",
listener: () => void,
): this
once(
event: "readable",
listener: () => void,
): this
once(
event: "error",
listener: (err: Error) => void,
): this
once(
event: string | symbol,
listener: (...args: any[]) => void,
): this
prependListener(
event: "aborted",
listener: (
hadError: boolean,
code: number,
) => void
,
): this
prependListener(
event: "close",
listener: () => void,
): this
prependListener(
event: "data",
listener: (chunk: Buffer | string) => void,
): this
prependListener(
event: "end",
listener: () => void,
): this
prependListener(
event: "readable",
listener: () => void,
): this
prependListener(
event: "error",
listener: (err: Error) => void,
): this
prependListener(
event: string | symbol,
listener: (...args: any[]) => void,
): this
prependOnceListener(
event: "aborted",
listener: (
hadError: boolean,
code: number,
) => void
,
): this
prependOnceListener(
event: "close",
listener: () => void,
): this
prependOnceListener(
event: "data",
listener: (chunk: Buffer | string) => void,
): this
prependOnceListener(
event: "end",
listener: () => void,
): this
prependOnceListener(
event: "readable",
listener: () => void,
): this
prependOnceListener(
event: "error",
listener: (err: Error) => void,
): this
prependOnceListener(
event: string | symbol,
listener: (...args: any[]) => void,
): this
read(size?: number):
Buffer
| string
| null
setTimeout(
msecs: number,
callback?: () => void,
): void

Sets the Http2Stream's timeout value to msecs. If a callback is provided, then it is added as a listener on the 'timeout' event on the response object.

If no 'timeout' listener is added to the request, the response, or the server, then Http2Streams are destroyed when they time out. If a handler is assigned to the request, the response, or the server's 'timeout'events, timed out sockets must be handled explicitly.


class Http2ServerResponse

extends stream.Writable

Usage in Deno

import { Http2ServerResponse } from "node:http2";

This object is created internally by an HTTP server, not by the user. It is passed as the second parameter to the 'request' event.

Constructors

Http2ServerResponse(stream: ServerHttp2Stream)
new

Type Parameters

Request extends Http2ServerRequest = Http2ServerRequest

Properties

connection: net.Socket | tls.TLSSocket
deprecated
readonly

See response.socket.

finished: boolean
deprecated
readonly

Boolean value that indicates whether the response has completed. Starts as false. After response.end() executes, the value will be true.

headersSent: boolean
readonly

True if headers were sent, false otherwise (read-only).

req: Request
readonly

A reference to the original HTTP2 request object.

sendDate: boolean

When true, the Date header will be automatically generated and sent in the response if it is not already present in the headers. Defaults to true.

This should only be disabled for testing; HTTP requires the Date header in responses.

socket: net.Socket | tls.TLSSocket
readonly

Returns a Proxy object that acts as a net.Socket (or tls.TLSSocket) but applies getters, setters, and methods based on HTTP/2 logic.

destroyed, readable, and writable properties will be retrieved from and set on response.stream.

destroy, emit, end, on and once methods will be called on response.stream.

setTimeout method will be called on response.stream.session.

pause, read, resume, and write will throw an error with code ERR_HTTP2_NO_SOCKET_MANIPULATION. See Http2Session and Sockets for more information.

All other interactions will be routed directly to the socket.

import http2 from 'node:http2';
const server = http2.createServer((req, res) => {
  const ip = req.socket.remoteAddress;
  const port = req.socket.remotePort;
  res.end(`Your IP address is ${ip} and your source port is ${port}.`);
}).listen(3000);
statusCode: number

When using implicit headers (not calling response.writeHead() explicitly), this property controls the status code that will be sent to the client when the headers get flushed.

response.statusCode = 404;

After response header was sent to the client, this property indicates the status code which was sent out.

statusMessage: ""

Status message is not supported by HTTP/2 (RFC 7540 8.1.2.4). It returns an empty string.

stream: ServerHttp2Stream
readonly

The Http2Stream object backing the response.

Methods

addListener(
event: "close",
listener: () => void,
): this
addListener(
event: "drain",
listener: () => void,
): this
addListener(
event: "error",
listener: (error: Error) => void,
): this
addListener(
event: "finish",
listener: () => void,
): this
addListener(
event: "pipe",
listener: (src: stream.Readable) => void,
): this
addListener(
event: "unpipe",
listener: (src: stream.Readable) => void,
): this
addListener(
event: string | symbol,
listener: (...args: any[]) => void,
): this
addTrailers(trailers: OutgoingHttpHeaders): void

This method adds HTTP trailing headers (a header but at the end of the message) to the response.

Attempting to set a header field name or value that contains invalid characters will result in a TypeError being thrown.

appendHeader(
name: string,
value: string | string[],
): void

Append a single header value to the header object.

If the value is an array, this is equivalent to calling this method multiple times.

If there were no previous values for the header, this is equivalent to calling setHeader.

Attempting to set a header field name or value that contains invalid characters will result in a TypeError being thrown.

// Returns headers including "set-cookie: a" and "set-cookie: b"
const server = http2.createServer((req, res) => {
  res.setHeader('set-cookie', 'a');
  res.appendHeader('set-cookie', 'b');
  res.writeHead(200);
  res.end('ok');
});
createPushResponse(
headers: OutgoingHttpHeaders,
callback: (
err: Error | null,
res: Http2ServerResponse,
) => void
,
): void

Call http2stream.pushStream() with the given headers, and wrap the given Http2Stream on a newly created Http2ServerResponse as the callback parameter if successful. When Http2ServerRequest is closed, the callback is called with an error ERR_HTTP2_INVALID_STREAM.

emit(event: "close"): boolean
emit(event: "drain"): boolean
emit(
event: "error",
error: Error,
): boolean
emit(event: "finish"): boolean
emit(
event: "pipe",
src: stream.Readable,
): boolean
emit(
event: "unpipe",
src: stream.Readable,
): boolean
emit(
event: string | symbol,
...args: any[],
): boolean
end(callback?: () => void): this

This method signals to the server that all of the response headers and body have been sent; that server should consider this message complete. The method, response.end(), MUST be called on each response.

If data is specified, it is equivalent to calling response.write(data, encoding) followed by response.end(callback).

If callback is specified, it will be called when the response stream is finished.

end(
data: string | Uint8Array,
callback?: () => void,
): this
end(
data: string | Uint8Array,
encoding: BufferEncoding,
callback?: () => void,
): this
getHeader(name: string): string

Reads out a header that has already been queued but not sent to the client. The name is case-insensitive.

const contentType = response.getHeader('content-type');
getHeaderNames(): string[]

Returns an array containing the unique names of the current outgoing headers. All header names are lowercase.

response.setHeader('Foo', 'bar');
response.setHeader('Set-Cookie', ['foo=bar', 'bar=baz']);

const headerNames = response.getHeaderNames();
// headerNames === ['foo', 'set-cookie']
getHeaders(): OutgoingHttpHeaders

Returns a shallow copy of the current outgoing headers. Since a shallow copy is used, array values may be mutated without additional calls to various header-related http module methods. The keys of the returned object are the header names and the values are the respective header values. All header names are lowercase.

The object returned by the response.getHeaders() method does not prototypically inherit from the JavaScript Object. This means that typical Object methods such as obj.toString(), obj.hasOwnProperty(), and others are not defined and will not work.

response.setHeader('Foo', 'bar');
response.setHeader('Set-Cookie', ['foo=bar', 'bar=baz']);

const headers = response.getHeaders();
// headers === { foo: 'bar', 'set-cookie': ['foo=bar', 'bar=baz'] }
hasHeader(name: string): boolean

Returns true if the header identified by name is currently set in the outgoing headers. The header name matching is case-insensitive.

const hasContentType = response.hasHeader('content-type');
on(
event: "close",
listener: () => void,
): this
on(
event: "drain",
listener: () => void,
): this
on(
event: "error",
listener: (error: Error) => void,
): this
on(
event: "finish",
listener: () => void,
): this
on(
event: "pipe",
listener: (src: stream.Readable) => void,
): this
on(
event: "unpipe",
listener: (src: stream.Readable) => void,
): this
on(
event: string | symbol,
listener: (...args: any[]) => void,
): this
once(
event: "close",
listener: () => void,
): this
once(
event: "drain",
listener: () => void,
): this
once(
event: "error",
listener: (error: Error) => void,
): this
once(
event: "finish",
listener: () => void,
): this
once(
event: "pipe",
listener: (src: stream.Readable) => void,
): this
once(
event: "unpipe",
listener: (src: stream.Readable) => void,
): this
once(
event: string | symbol,
listener: (...args: any[]) => void,
): this
prependListener(
event: "close",
listener: () => void,
): this
prependListener(
event: "drain",
listener: () => void,
): this
prependListener(
event: "error",
listener: (error: Error) => void,
): this
prependListener(
event: "finish",
listener: () => void,
): this
prependListener(
event: "pipe",
listener: (src: stream.Readable) => void,
): this
prependListener(
event: "unpipe",
listener: (src: stream.Readable) => void,
): this
prependListener(
event: string | symbol,
listener: (...args: any[]) => void,
): this
prependOnceListener(
event: "close",
listener: () => void,
): this
prependOnceListener(
event: "drain",
listener: () => void,
): this
prependOnceListener(
event: "error",
listener: (error: Error) => void,
): this
prependOnceListener(
event: "finish",
listener: () => void,
): this
prependOnceListener(
event: "pipe",
listener: (src: stream.Readable) => void,
): this
prependOnceListener(
event: "unpipe",
listener: (src: stream.Readable) => void,
): this
prependOnceListener(
event: string | symbol,
listener: (...args: any[]) => void,
): this
removeHeader(name: string): void

Removes a header that has been queued for implicit sending.

response.removeHeader('Content-Encoding');
setHeader(
name: string,
value:
number
| string
| readonly string[]
,
): void

Sets a single header value for implicit headers. If this header already exists in the to-be-sent headers, its value will be replaced. Use an array of strings here to send multiple headers with the same name.

response.setHeader('Content-Type', 'text/html; charset=utf-8');

or

response.setHeader('Set-Cookie', ['type=ninja', 'language=javascript']);

Attempting to set a header field name or value that contains invalid characters will result in a TypeError being thrown.

When headers have been set with response.setHeader(), they will be merged with any headers passed to response.writeHead(), with the headers passed to response.writeHead() given precedence.

// Returns content-type = text/plain
const server = http2.createServer((req, res) => {
  res.setHeader('Content-Type', 'text/html; charset=utf-8');
  res.setHeader('X-Foo', 'bar');
  res.writeHead(200, { 'Content-Type': 'text/plain; charset=utf-8' });
  res.end('ok');
});
setTimeout(
msecs: number,
callback?: () => void,
): void

Sets the Http2Stream's timeout value to msecs. If a callback is provided, then it is added as a listener on the 'timeout' event on the response object.

If no 'timeout' listener is added to the request, the response, or the server, then Http2Stream s are destroyed when they time out. If a handler is assigned to the request, the response, or the server's 'timeout' events, timed out sockets must be handled explicitly.

write(
chunk: string | Uint8Array,
callback?: (err: Error) => void,
): boolean

If this method is called and response.writeHead() has not been called, it will switch to implicit header mode and flush the implicit headers.

This sends a chunk of the response body. This method may be called multiple times to provide successive parts of the body.

In the node:http module, the response body is omitted when the request is a HEAD request. Similarly, the 204 and 304 responses must not include a message body.

chunk can be a string or a buffer. If chunk is a string, the second parameter specifies how to encode it into a byte stream. By default the encoding is 'utf8'. callback will be called when this chunk of data is flushed.

This is the raw HTTP body and has nothing to do with higher-level multi-part body encodings that may be used.

The first time response.write() is called, it will send the buffered header information and the first chunk of the body to the client. The second time response.write() is called, Node.js assumes data will be streamed, and sends the new data separately. That is, the response is buffered up to the first chunk of the body.

Returns true if the entire data was flushed successfully to the kernel buffer. Returns false if all or part of the data was queued in user memory.'drain' will be emitted when the buffer is free again.

write(
chunk: string | Uint8Array,
encoding: BufferEncoding,
callback?: (err: Error) => void,
): boolean
writeContinue(): void

Sends a status 100 Continue to the client, indicating that the request body should be sent. See the 'checkContinue' event on Http2Server and Http2SecureServer.

writeEarlyHints(hints: Record<string, string | string[]>): void

Sends a status 103 Early Hints to the client with a Link header, indicating that the user agent can preload/preconnect the linked resources. The hints is an object containing the values of headers to be sent with early hints message.

Example

const earlyHintsLink = '</styles.css>; rel=preload; as=style';
response.writeEarlyHints({
  'link': earlyHintsLink,
});

const earlyHintsLinks = [
  '</styles.css>; rel=preload; as=style',
  '</scripts.js>; rel=preload; as=script',
];
response.writeEarlyHints({
  'link': earlyHintsLinks,
});
writeHead(
statusCode: number,
headers?: OutgoingHttpHeaders,
): this

Sends a response header to the request. The status code is a 3-digit HTTP status code, like 404. The last argument, headers, are the response headers.

Returns a reference to the Http2ServerResponse, so that calls can be chained.

For compatibility with HTTP/1, a human-readable statusMessage may be passed as the second argument. However, because the statusMessage has no meaning within HTTP/2, the argument will have no effect and a process warning will be emitted.

const body = 'hello world';
response.writeHead(200, {
  'Content-Length': Buffer.byteLength(body),
  'Content-Type': 'text/plain; charset=utf-8',
});

Content-Length is given in bytes not characters. TheBuffer.byteLength() API may be used to determine the number of bytes in a given encoding. On outbound messages, Node.js does not check if Content-Length and the length of the body being transmitted are equal or not. However, when receiving messages, Node.js will automatically reject messages when the Content-Length does not match the actual payload size.

This method may be called at most one time on a message before response.end() is called.

If response.write() or response.end() are called before calling this, the implicit/mutable headers will be calculated and call this function.

When headers have been set with response.setHeader(), they will be merged with any headers passed to response.writeHead(), with the headers passed to response.writeHead() given precedence.

// Returns content-type = text/plain
const server = http2.createServer((req, res) => {
  res.setHeader('Content-Type', 'text/html; charset=utf-8');
  res.setHeader('X-Foo', 'bar');
  res.writeHead(200, { 'Content-Type': 'text/plain; charset=utf-8' });
  res.end('ok');
});

Attempting to set a header field name or value that contains invalid characters will result in a TypeError being thrown.

writeHead(
statusCode: number,
statusMessage: string,
headers?: OutgoingHttpHeaders,
): this

function connect

Usage in Deno

import { connect } from "node:http2";

Overload 1

connect(
authority: string | url.URL,
listener: (
session: ClientHttp2Session,
socket: net.Socket | tls.TLSSocket,
) => void
,
): ClientHttp2Session

Returns a ClientHttp2Session instance.

import http2 from 'node:http2';
const client = http2.connect('https://localhost:1234');

// Use the client

client.close();

Parameters

authority: string | url.URL

The remote HTTP/2 server to connect to. This must be in the form of a minimal, valid URL with the http:// or https:// prefix, host name, and IP port (if a non-default port is used). Userinfo (user ID and password), path, querystring, and fragment details in the URL will be ignored.

listener: (
session: ClientHttp2Session,
socket: net.Socket | tls.TLSSocket,
) => void

Will be registered as a one-time listener of the 'connect' event.

Return Type

ClientHttp2Session

Overload 2

connect(
authority: string | url.URL,
options?: ClientSessionOptions | SecureClientSessionOptions,
listener?: (
session: ClientHttp2Session,
socket: net.Socket | tls.TLSSocket,
) => void
,
): ClientHttp2Session

Parameters

authority: string | url.URL
options: ClientSessionOptions | SecureClientSessionOptions
optional
listener: (
session: ClientHttp2Session,
socket: net.Socket | tls.TLSSocket,
) => void
optional

Return Type

ClientHttp2Session

function createSecureServer

Usage in Deno

import { createSecureServer } from "node:http2";

Overload 1

createSecureServer(onRequestHandler?: (
request: Http2ServerRequest,
response: Http2ServerResponse,
) => void
): Http2SecureServer

Returns a tls.Server instance that creates and manages Http2Session instances.

import http2 from 'node:http2';
import fs from 'node:fs';

const options = {
  key: fs.readFileSync('server-key.pem'),
  cert: fs.readFileSync('server-cert.pem'),
};

// Create a secure HTTP/2 server
const server = http2.createSecureServer(options);

server.on('stream', (stream, headers) => {
  stream.respond({
    'content-type': 'text/html; charset=utf-8',
    ':status': 200,
  });
  stream.end('<h1>Hello World</h1>');
});

server.listen(8443);

Parameters

onRequestHandler: (
request: Http2ServerRequest,
response: Http2ServerResponse,
) => void
optional

See Compatibility API

Return Type

Http2SecureServer

Overload 2

createSecureServer<
Http1Request extends IncomingMessage = IncomingMessage,
Http1Response extends ServerResponse = ServerResponse,
Http2Request extends Http2ServerRequest = Http2ServerRequest,
Http2Response extends Http2ServerResponse = Http2ServerResponse,
>
(
options: SecureServerOptions<Http1Request, Http1Response, Http2Request, Http2Response>,
onRequestHandler?: (
request: InstanceType<Http2Request>,
response: InstanceType<Http2Response>,
) => void
,
): Http2SecureServer<Http1Request, Http1Response, Http2Request, Http2Response>

Type Parameters

Http1Request extends IncomingMessage = IncomingMessage
Http1Response extends ServerResponse = ServerResponse
Http2Request extends Http2ServerRequest = Http2ServerRequest
Http2Response extends Http2ServerResponse = Http2ServerResponse

Parameters

options: SecureServerOptions<Http1Request, Http1Response, Http2Request, Http2Response>
onRequestHandler: (
request: InstanceType<Http2Request>,
response: InstanceType<Http2Response>,
) => void
optional

Return Type

Http2SecureServer<Http1Request, Http1Response, Http2Request, Http2Response>

function createServer

Usage in Deno

import { createServer } from "node:http2";

Overload 1

createServer(onRequestHandler?: (
request: Http2ServerRequest,
response: Http2ServerResponse,
) => void
): Http2Server

Returns a net.Server instance that creates and manages Http2Session instances.

Since there are no browsers known that support unencrypted HTTP/2, the use of createSecureServer is necessary when communicating with browser clients.

import http2 from 'node:http2';

// Create an unencrypted HTTP/2 server.
// Since there are no browsers known that support
// unencrypted HTTP/2, the use of `http2.createSecureServer()`
// is necessary when communicating with browser clients.
const server = http2.createServer();

server.on('stream', (stream, headers) => {
  stream.respond({
    'content-type': 'text/html; charset=utf-8',
    ':status': 200,
  });
  stream.end('<h1>Hello World</h1>');
});

server.listen(8000);

Parameters

onRequestHandler: (
request: Http2ServerRequest,
response: Http2ServerResponse,
) => void
optional

See Compatibility API

Return Type

Http2Server

Overload 2

createServer<
Http1Request extends IncomingMessage = IncomingMessage,
Http1Response extends ServerResponse = ServerResponse,
Http2Request extends Http2ServerRequest = Http2ServerRequest,
Http2Response extends Http2ServerResponse = Http2ServerResponse,
>
(
options: ServerOptions<Http1Request, Http1Response, Http2Request, Http2Response>,
onRequestHandler?: (
request: InstanceType<Http2Request>,
response: InstanceType<Http2Response>,
) => void
,
): Http2Server<Http1Request, Http1Response, Http2Request, Http2Response>

Type Parameters

Http1Request extends IncomingMessage = IncomingMessage
Http1Response extends ServerResponse = ServerResponse
Http2Request extends Http2ServerRequest = Http2ServerRequest
Http2Response extends Http2ServerResponse = Http2ServerResponse

Parameters

options: ServerOptions<Http1Request, Http1Response, Http2Request, Http2Response>
onRequestHandler: (
request: InstanceType<Http2Request>,
response: InstanceType<Http2Response>,
) => void
optional

Return Type

Http2Server<Http1Request, Http1Response, Http2Request, Http2Response>

function getDefaultSettings

Usage in Deno

import { getDefaultSettings } from "node:http2";
getDefaultSettings(): Settings
Deno compatibility

This function is a non-functional stub.

Returns an object containing the default settings for an Http2Session instance. This method returns a new object instance every time it is called so instances returned may be safely modified for use.

Return Type

Settings

function getPackedSettings

Usage in Deno

import { getPackedSettings } from "node:http2";
getPackedSettings(settings: Settings): Buffer
Deno compatibility

This function is a non-functional stub.

Returns a Buffer instance containing serialized representation of the given HTTP/2 settings as specified in the HTTP/2 specification. This is intended for use with the HTTP2-Settings header field.

import http2 from 'node:http2';

const packed = http2.getPackedSettings({ enablePush: false });

console.log(packed.toString('base64'));
// Prints: AAIAAAAA

Parameters

settings: Settings

Return Type

Buffer

function getUnpackedSettings

Usage in Deno

import { getUnpackedSettings } from "node:http2";
getUnpackedSettings(buf: Uint8Array): Settings
Deno compatibility

This function is a non-functional stub.

Returns a HTTP/2 Settings Object containing the deserialized settings from the given Buffer as generated by http2.getPackedSettings().

Parameters

buf: Uint8Array

The packed settings.

Return Type

Settings

function performServerHandshake

Usage in Deno

import { performServerHandshake } from "node:http2";
performServerHandshake<
Http1Request extends IncomingMessage = IncomingMessage,
Http1Response extends ServerResponse = ServerResponse,
Http2Request extends Http2ServerRequest = Http2ServerRequest,
Http2Response extends Http2ServerResponse = Http2ServerResponse,
>
(
socket: stream.Duplex,
options?: ServerOptions<Http1Request, Http1Response, Http2Request, Http2Response>,
): ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>

Create an HTTP/2 server session from an existing socket.

Type Parameters

Http1Request extends IncomingMessage = IncomingMessage
Http1Response extends ServerResponse = ServerResponse
Http2Request extends Http2ServerRequest = Http2ServerRequest
Http2Response extends Http2ServerResponse = Http2ServerResponse

Parameters

socket: stream.Duplex

A Duplex Stream

options: ServerOptions<Http1Request, Http1Response, Http2Request, Http2Response>
optional

Any [createServer](/api/node/http2/ options can be provided.

Return Type

ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>

interface AlternativeServiceOptions

Usage in Deno

import { type AlternativeServiceOptions } from "node:http2";

Properties

origin:
number
| string
| url.URL

interface ClientHttp2Session

extends Http2Session

Usage in Deno

import { type ClientHttp2Session } from "node:http2";

Methods

request(
headers?: OutgoingHttpHeaders,
options?: ClientSessionRequestOptions,
): ClientHttp2Stream

For HTTP/2 Client Http2Session instances only, the http2session.request() creates and returns an Http2Stream instance that can be used to send an HTTP/2 request to the connected server.

When a ClientHttp2Session is first created, the socket may not yet be connected. if clienthttp2session.request() is called during this time, the actual request will be deferred until the socket is ready to go. If the session is closed before the actual request be executed, an ERR_HTTP2_GOAWAY_SESSION is thrown.

This method is only available if http2session.type is equal to http2.constants.NGHTTP2_SESSION_CLIENT.

import http2 from 'node:http2';
const clientSession = http2.connect('https://localhost:1234');
const {
  HTTP2_HEADER_PATH,
  HTTP2_HEADER_STATUS,
} = http2.constants;

const req = clientSession.request({ [HTTP2_HEADER_PATH]: '/' });
req.on('response', (headers) => {
  console.log(headers[HTTP2_HEADER_STATUS]);
  req.on('data', (chunk) => { // ..  });
  req.on('end', () => { // ..  });
});

When the options.waitForTrailers option is set, the 'wantTrailers' event is emitted immediately after queuing the last chunk of payload data to be sent. The http2stream.sendTrailers() method can then be called to send trailing headers to the peer.

When options.waitForTrailers is set, the Http2Stream will not automatically close when the final DATA frame is transmitted. User code must call eitherhttp2stream.sendTrailers() or http2stream.close() to close theHttp2Stream.

When options.signal is set with an AbortSignal and then abort on the corresponding AbortController is called, the request will emit an 'error'event with an AbortError error.

The :method and :path pseudo-headers are not specified within headers, they respectively default to:

  • :method = 'GET'
  • :path = /
addListener(
event: "altsvc",
listener: (
alt: string,
origin: string,
stream: number,
) => void
,
): this
addListener(
event: "origin",
listener: (origins: string[]) => void,
): this
addListener(
event: "connect",
listener: (
session: ClientHttp2Session,
socket: net.Socket | tls.TLSSocket,
) => void
,
): this
addListener(
event: "stream",
listener: (
stream: ClientHttp2Stream,
headers: IncomingHttpHeaders & IncomingHttpStatusHeader,
flags: number,
) => void
,
): this
addListener(
event: string | symbol,
listener: (...args: any[]) => void,
): this
emit(
event: "altsvc",
alt: string,
origin: string,
stream: number,
): boolean
emit(
event: "origin",
origins: readonly string[],
): boolean
emit(
event: "connect",
session: ClientHttp2Session,
socket: net.Socket | tls.TLSSocket,
): boolean
emit(
event: "stream",
stream: ClientHttp2Stream,
headers: IncomingHttpHeaders & IncomingHttpStatusHeader,
flags: number,
): boolean
emit(
event: string | symbol,
...args: any[],
): boolean
on(
event: "altsvc",
listener: (
alt: string,
origin: string,
stream: number,
) => void
,
): this
on(
event: "origin",
listener: (origins: string[]) => void,
): this
on(
event: "connect",
listener: (
session: ClientHttp2Session,
socket: net.Socket | tls.TLSSocket,
) => void
,
): this
on(
event: "stream",
listener: (
stream: ClientHttp2Stream,
headers: IncomingHttpHeaders & IncomingHttpStatusHeader,
flags: number,
) => void
,
): this
on(
event: string | symbol,
listener: (...args: any[]) => void,
): this
once(
event: "altsvc",
listener: (
alt: string,
origin: string,
stream: number,
) => void
,
): this
once(
event: "origin",
listener: (origins: string[]) => void,
): this
once(
event: "connect",
listener: (
session: ClientHttp2Session,
socket: net.Socket | tls.TLSSocket,
) => void
,
): this
once(
event: "stream",
listener: (
stream: ClientHttp2Stream,
headers: IncomingHttpHeaders & IncomingHttpStatusHeader,
flags: number,
) => void
,
): this
once(
event: string | symbol,
listener: (...args: any[]) => void,
): this
prependListener(
event: "altsvc",
listener: (
alt: string,
origin: string,
stream: number,
) => void
,
): this
prependListener(
event: "origin",
listener: (origins: string[]) => void,
): this
prependListener(
event: "connect",
listener: (
session: ClientHttp2Session,
socket: net.Socket | tls.TLSSocket,
) => void
,
): this
prependListener(
event: "stream",
listener: (
stream: ClientHttp2Stream,
headers: IncomingHttpHeaders & IncomingHttpStatusHeader,
flags: number,
) => void
,
): this
prependListener(
event: string | symbol,
listener: (...args: any[]) => void,
): this
prependOnceListener(
event: "altsvc",
listener: (
alt: string,
origin: string,
stream: number,
) => void
,
): this
prependOnceListener(
event: "origin",
listener: (origins: string[]) => void,
): this
prependOnceListener(
event: "connect",
listener: (
session: ClientHttp2Session,
socket: net.Socket | tls.TLSSocket,
) => void
,
): this
prependOnceListener(
event: "stream",
listener: (
stream: ClientHttp2Stream,
headers: IncomingHttpHeaders & IncomingHttpStatusHeader,
flags: number,
) => void
,
): this
prependOnceListener(
event: string | symbol,
listener: (...args: any[]) => void,
): this

interface ClientHttp2Stream

extends Http2Stream

Usage in Deno

import { type ClientHttp2Stream } from "node:http2";
Deno compatibility

All methods are non-functional stubs.

Methods

addListener(
event: "continue",
listener: () => { },
): this
addListener(
event: "headers",
listener: (
headers: IncomingHttpHeaders & IncomingHttpStatusHeader,
flags: number,
) => void
,
): this
addListener(
event: "push",
listener: (
headers: IncomingHttpHeaders,
flags: number,
) => void
,
): this
addListener(
event: "response",
listener: (
headers: IncomingHttpHeaders & IncomingHttpStatusHeader,
flags: number,
) => void
,
): this
addListener(
event: string | symbol,
listener: (...args: any[]) => void,
): this
emit(event: "continue"): boolean
emit(
event: "headers",
headers: IncomingHttpHeaders & IncomingHttpStatusHeader,
flags: number,
): boolean
emit(
event: "push",
headers: IncomingHttpHeaders,
flags: number,
): boolean
emit(
event: "response",
headers: IncomingHttpHeaders & IncomingHttpStatusHeader,
flags: number,
): boolean
emit(
event: string | symbol,
...args: any[],
): boolean
on(
event: "continue",
listener: () => { },
): this
on(
event: "headers",
listener: (
headers: IncomingHttpHeaders & IncomingHttpStatusHeader,
flags: number,
) => void
,
): this
on(
event: "push",
listener: (
headers: IncomingHttpHeaders,
flags: number,
) => void
,
): this
on(
event: "response",
listener: (
headers: IncomingHttpHeaders & IncomingHttpStatusHeader,
flags: number,
) => void
,
): this
on(
event: string | symbol,
listener: (...args: any[]) => void,
): this
once(
event: "continue",
listener: () => { },
): this
once(
event: "headers",
listener: (
headers: IncomingHttpHeaders & IncomingHttpStatusHeader,
flags: number,
) => void
,
): this
once(
event: "push",
listener: (
headers: IncomingHttpHeaders,
flags: number,
) => void
,
): this
once(
event: "response",
listener: (
headers: IncomingHttpHeaders & IncomingHttpStatusHeader,
flags: number,
) => void
,
): this
once(
event: string | symbol,
listener: (...args: any[]) => void,
): this
prependListener(
event: "continue",
listener: () => { },
): this
prependListener(
event: "headers",
listener: (
headers: IncomingHttpHeaders & IncomingHttpStatusHeader,
flags: number,
) => void
,
): this
prependListener(
event: "push",
listener: (
headers: IncomingHttpHeaders,
flags: number,
) => void
,
): this
prependListener(
event: "response",
listener: (
headers: IncomingHttpHeaders & IncomingHttpStatusHeader,
flags: number,
) => void
,
): this
prependListener(
event: string | symbol,
listener: (...args: any[]) => void,
): this
prependOnceListener(
event: "continue",
listener: () => { },
): this
prependOnceListener(
event: "headers",
listener: (
headers: IncomingHttpHeaders & IncomingHttpStatusHeader,
flags: number,
) => void
,
): this
prependOnceListener(
event: "push",
listener: (
headers: IncomingHttpHeaders,
flags: number,
) => void
,
): this
prependOnceListener(
event: "response",
listener: (
headers: IncomingHttpHeaders & IncomingHttpStatusHeader,
flags: number,
) => void
,
): this
prependOnceListener(
event: string | symbol,
listener: (...args: any[]) => void,
): this

interface ClientSessionOptions

extends SessionOptions

Usage in Deno

import { type ClientSessionOptions } from "node:http2";

Properties

maxReservedRemoteStreams: number | undefined
optional
createConnection: ((
authority: url.URL,
option: SessionOptions,
) => stream.Duplex) | undefined
optional
protocol:
"http:"
| "https:"
| undefined
optional

interface ClientSessionRequestOptions

Usage in Deno

import { type ClientSessionRequestOptions } from "node:http2";

Properties

endStream: boolean | undefined
optional
exclusive: boolean | undefined
optional
parent: number | undefined
optional
weight: number | undefined
optional
waitForTrailers: boolean | undefined
optional
signal: AbortSignal | undefined
optional

interface Http2SecureServer

extends [tls.Server]HTTP2ServerCommon

Usage in Deno

import { type Http2SecureServer } from "node:http2";

Type Parameters

Http1Request extends IncomingMessage = IncomingMessage
Http1Response extends ServerResponse = ServerResponse
Http2Request extends Http2ServerRequest = Http2ServerRequest
Http2Response extends Http2ServerResponse = Http2ServerResponse

Methods

addListener(
event: "checkContinue",
listener: (
request: InstanceType<Http2Request>,
response: InstanceType<Http2Response>,
) => void
,
): this
addListener(
event: "request",
listener: (
request: InstanceType<Http2Request>,
response: InstanceType<Http2Response>,
) => void
,
): this
addListener(
event: "session",
listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>) => void,
): this
addListener(
event: "sessionError",
listener: (err: Error) => void,
): this
addListener(
event: "stream",
listener: (
stream: ServerHttp2Stream,
headers: IncomingHttpHeaders,
flags: number,
) => void
,
): this
addListener(
event: "timeout",
listener: () => void,
): this
addListener(
event: "unknownProtocol",
listener: (socket: tls.TLSSocket) => void,
): this
addListener(
event: string | symbol,
listener: (...args: any[]) => void,
): this
emit(
event: "checkContinue",
request: InstanceType<Http2Request>,
response: InstanceType<Http2Response>,
): boolean
emit(
event: "request",
request: InstanceType<Http2Request>,
response: InstanceType<Http2Response>,
): boolean
emit(
event: "session",
session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>,
): boolean
emit(
event: "sessionError",
err: Error,
): boolean
emit(
event: "stream",
stream: ServerHttp2Stream,
headers: IncomingHttpHeaders,
flags: number,
): boolean
emit(event: "timeout"): boolean
emit(
event: "unknownProtocol",
socket: tls.TLSSocket,
): boolean
emit(
event: string | symbol,
...args: any[],
): boolean
on(
event: "checkContinue",
listener: (
request: InstanceType<Http2Request>,
response: InstanceType<Http2Response>,
) => void
,
): this
on(
event: "request",
listener: (
request: InstanceType<Http2Request>,
response: InstanceType<Http2Response>,
) => void
,
): this
on(
event: "session",
listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>) => void,
): this
on(
event: "sessionError",
listener: (err: Error) => void,
): this
on(
event: "stream",
listener: (
stream: ServerHttp2Stream,
headers: IncomingHttpHeaders,
flags: number,
) => void
,
): this
on(
event: "timeout",
listener: () => void,
): this
on(
event: "unknownProtocol",
listener: (socket: tls.TLSSocket) => void,
): this
on(
event: string | symbol,
listener: (...args: any[]) => void,
): this
once(
event: "checkContinue",
listener: (
request: InstanceType<Http2Request>,
response: InstanceType<Http2Response>,
) => void
,
): this
once(
event: "request",
listener: (
request: InstanceType<Http2Request>,
response: InstanceType<Http2Response>,
) => void
,
): this
once(
event: "session",
listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>) => void,
): this
once(
event: "sessionError",
listener: (err: Error) => void,
): this
once(
event: "stream",
listener: (
stream: ServerHttp2Stream,
headers: IncomingHttpHeaders,
flags: number,
) => void
,
): this
once(
event: "timeout",
listener: () => void,
): this
once(
event: "unknownProtocol",
listener: (socket: tls.TLSSocket) => void,
): this
once(
event: string | symbol,
listener: (...args: any[]) => void,
): this
prependListener(
event: "checkContinue",
listener: (
request: InstanceType<Http2Request>,
response: InstanceType<Http2Response>,
) => void
,
): this
prependListener(
event: "request",
listener: (
request: InstanceType<Http2Request>,
response: InstanceType<Http2Response>,
) => void
,
): this
prependListener(
event: "session",
listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>) => void,
): this
prependListener(
event: "sessionError",
listener: (err: Error) => void,
): this
prependListener(
event: "stream",
listener: (
stream: ServerHttp2Stream,
headers: IncomingHttpHeaders,
flags: number,
) => void
,
): this
prependListener(
event: "timeout",
listener: () => void,
): this
prependListener(
event: "unknownProtocol",
listener: (socket: tls.TLSSocket) => void,
): this
prependListener(
event: string | symbol,
listener: (...args: any[]) => void,
): this
prependOnceListener(
event: "checkContinue",
listener: (
request: InstanceType<Http2Request>,
response: InstanceType<Http2Response>,
) => void
,
): this
prependOnceListener(
event: "request",
listener: (
request: InstanceType<Http2Request>,
response: InstanceType<Http2Response>,
) => void
,
): this
prependOnceListener(
event: "session",
listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>) => void,
): this
prependOnceListener(
event: "sessionError",
listener: (err: Error) => void,
): this
prependOnceListener(
event: "stream",
listener: (
stream: ServerHttp2Stream,
headers: IncomingHttpHeaders,
flags: number,
) => void
,
): this
prependOnceListener(
event: "timeout",
listener: () => void,
): this
prependOnceListener(
event: "unknownProtocol",
listener: (socket: tls.TLSSocket) => void,
): this
prependOnceListener(
event: string | symbol,
listener: (...args: any[]) => void,
): this

interface Http2Server

extends [net.Server]HTTP2ServerCommon

Usage in Deno

import { type Http2Server } from "node:http2";

Type Parameters

Http1Request extends IncomingMessage = IncomingMessage
Http1Response extends ServerResponse = ServerResponse
Http2Request extends Http2ServerRequest = Http2ServerRequest
Http2Response extends Http2ServerResponse = Http2ServerResponse

Methods

addListener(
event: "checkContinue",
listener: (
request: InstanceType<Http2Request>,
response: InstanceType<Http2Response>,
) => void
,
): this
addListener(
event: "request",
listener: (
request: InstanceType<Http2Request>,
response: InstanceType<Http2Response>,
) => void
,
): this
addListener(
event: "session",
listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>) => void,
): this
addListener(
event: "sessionError",
listener: (err: Error) => void,
): this
addListener(
event: "stream",
listener: (
stream: ServerHttp2Stream,
headers: IncomingHttpHeaders,
flags: number,
) => void
,
): this
addListener(
event: "timeout",
listener: () => void,
): this
addListener(
event: string | symbol,
listener: (...args: any[]) => void,
): this
emit(
event: "checkContinue",
request: InstanceType<Http2Request>,
response: InstanceType<Http2Response>,
): boolean
emit(
event: "request",
request: InstanceType<Http2Request>,
response: InstanceType<Http2Response>,
): boolean
emit(
event: "session",
session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>,
): boolean
emit(
event: "sessionError",
err: Error,
): boolean
emit(
event: "stream",
stream: ServerHttp2Stream,
headers: IncomingHttpHeaders,
flags: number,
): boolean
emit(event: "timeout"): boolean
emit(
event: string | symbol,
...args: any[],
): boolean
on(
event: "checkContinue",
listener: (
request: InstanceType<Http2Request>,
response: InstanceType<Http2Response>,
) => void
,
): this
on(
event: "request",
listener: (
request: InstanceType<Http2Request>,
response: InstanceType<Http2Response>,
) => void
,
): this
on(
event: "session",
listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>) => void,
): this
on(
event: "sessionError",
listener: (err: Error) => void,
): this
on(
event: "stream",
listener: (
stream: ServerHttp2Stream,
headers: IncomingHttpHeaders,
flags: number,
) => void
,
): this
on(
event: "timeout",
listener: () => void,
): this
on(
event: string | symbol,
listener: (...args: any[]) => void,
): this
once(
event: "checkContinue",
listener: (
request: InstanceType<Http2Request>,
response: InstanceType<Http2Response>,
) => void
,
): this
once(
event: "request",
listener: (
request: InstanceType<Http2Request>,
response: InstanceType<Http2Response>,
) => void
,
): this
once(
event: "session",
listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>) => void,
): this
once(
event: "sessionError",
listener: (err: Error) => void,
): this
once(
event: "stream",
listener: (
stream: ServerHttp2Stream,
headers: IncomingHttpHeaders,
flags: number,
) => void
,
): this
once(
event: "timeout",
listener: () => void,
): this
once(
event: string | symbol,
listener: (...args: any[]) => void,
): this
prependListener(
event: "checkContinue",
listener: (
request: InstanceType<Http2Request>,
response: InstanceType<Http2Response>,
) => void
,
): this
prependListener(
event: "request",
listener: (
request: InstanceType<Http2Request>,
response: InstanceType<Http2Response>,
) => void
,
): this
prependListener(
event: "session",
listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>) => void,
): this
prependListener(
event: "sessionError",
listener: (err: Error) => void,
): this
prependListener(
event: "stream",
listener: (
stream: ServerHttp2Stream,
headers: IncomingHttpHeaders,
flags: number,
) => void
,
): this
prependListener(
event: "timeout",
listener: () => void,
): this
prependListener(
event: string | symbol,
listener: (...args: any[]) => void,
): this
prependOnceListener(
event: "checkContinue",
listener: (
request: InstanceType<Http2Request>,
response: InstanceType<Http2Response>,
) => void
,
): this
prependOnceListener(
event: "request",
listener: (
request: InstanceType<Http2Request>,
response: InstanceType<Http2Response>,
) => void
,
): this
prependOnceListener(
event: "session",
listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>) => void,
): this
prependOnceListener(
event: "sessionError",
listener: (err: Error) => void,
): this
prependOnceListener(
event: "stream",
listener: (
stream: ServerHttp2Stream,
headers: IncomingHttpHeaders,
flags: number,
) => void
,
): this
prependOnceListener(
event: "timeout",
listener: () => void,
): this
prependOnceListener(
event: string | symbol,
listener: (...args: any[]) => void,
): this

interface HTTP2ServerCommon

Usage in Deno

import { type HTTP2ServerCommon } from "node:http2";

Methods

setTimeout(
msec?: number,
callback?: () => void,
): this
updateSettings(settings: Settings): void

Throws ERR_HTTP2_INVALID_SETTING_VALUE for invalid settings values. Throws ERR_INVALID_ARG_TYPE for invalid settings argument.


interface Http2Session

extends EventEmitter

Usage in Deno

import { type Http2Session } from "node:http2";
Deno compatibility

The following methods are non-functional stubs:

  • setLocalWindowSize
  • ping
  • localSettings
  • remoteSettings
  • settings
  • ref
  • unref

Properties

alpnProtocol: string | undefined
readonly
optional

Value will be undefined if the Http2Session is not yet connected to a socket, h2c if the Http2Session is not connected to a TLSSocket, or will return the value of the connected TLSSocket's own alpnProtocol property.

closed: boolean
readonly

Will be true if this Http2Session instance has been closed, otherwise false.

connecting: boolean
readonly

Will be true if this Http2Session instance is still connecting, will be set to false before emitting connect event and/or calling the http2.connect callback.

destroyed: boolean
readonly

Will be true if this Http2Session instance has been destroyed and must no longer be used, otherwise false.

encrypted: boolean | undefined
readonly
optional

Value is undefined if the Http2Session session socket has not yet been connected, true if the Http2Session is connected with a TLSSocket, and false if the Http2Session is connected to any other kind of socket or stream.

localSettings: Settings
readonly

A prototype-less object describing the current local settings of this Http2Session. The local settings are local to thisHttp2Session instance.

originSet: string[] | undefined
readonly
optional

If the Http2Session is connected to a TLSSocket, the originSet property will return an Array of origins for which the Http2Session may be considered authoritative.

The originSet property is only available when using a secure TLS connection.

pendingSettingsAck: boolean
readonly

Indicates whether the Http2Session is currently waiting for acknowledgment of a sent SETTINGS frame. Will be true after calling the http2session.settings() method. Will be false once all sent SETTINGS frames have been acknowledged.

remoteSettings: Settings
readonly

A prototype-less object describing the current remote settings of thisHttp2Session. The remote settings are set by the connected HTTP/2 peer.

socket: net.Socket | tls.TLSSocket
readonly

Returns a Proxy object that acts as a net.Socket (or tls.TLSSocket) but limits available methods to ones safe to use with HTTP/2.

destroy, emit, end, pause, read, resume, and write will throw an error with code ERR_HTTP2_NO_SOCKET_MANIPULATION. See Http2Session and Sockets for more information.

setTimeout method will be called on this Http2Session.

All other interactions will be routed directly to the socket.

state: SessionState
readonly

Provides miscellaneous information about the current state of theHttp2Session.

An object describing the current status of this Http2Session.

type: number
readonly

The http2session.type will be equal to http2.constants.NGHTTP2_SESSION_SERVER if this Http2Session instance is a server, and http2.constants.NGHTTP2_SESSION_CLIENT if the instance is a client.

Methods

close(callback?: () => void): void

Gracefully closes the Http2Session, allowing any existing streams to complete on their own and preventing new Http2Stream instances from being created. Once closed, http2session.destroy()might be called if there are no open Http2Stream instances.

If specified, the callback function is registered as a handler for the'close' event.

destroy(
error?: Error,
code?: number,
): void

Immediately terminates the Http2Session and the associated net.Socket or tls.TLSSocket.

Once destroyed, the Http2Session will emit the 'close' event. If error is not undefined, an 'error' event will be emitted immediately before the 'close' event.

If there are any remaining open Http2Streams associated with the Http2Session, those will also be destroyed.

goaway(
code?: number,
lastStreamID?: number,
opaqueData?: ArrayBufferView,
): void

Transmits a GOAWAY frame to the connected peer without shutting down theHttp2Session.

ping(callback: (
err: Error | null,
duration: number,
payload: Buffer,
) => void
): boolean

Sends a PING frame to the connected HTTP/2 peer. A callback function must be provided. The method will return true if the PING was sent, false otherwise.

The maximum number of outstanding (unacknowledged) pings is determined by the maxOutstandingPings configuration option. The default maximum is 10.

If provided, the payload must be a Buffer, TypedArray, or DataView containing 8 bytes of data that will be transmitted with the PING and returned with the ping acknowledgment.

The callback will be invoked with three arguments: an error argument that will be null if the PING was successfully acknowledged, a duration argument that reports the number of milliseconds elapsed since the ping was sent and the acknowledgment was received, and a Buffer containing the 8-byte PING payload.

session.ping(Buffer.from('abcdefgh'), (err, duration, payload) => {
  if (!err) {
    console.log(`Ping acknowledged in ${duration} milliseconds`);
    console.log(`With payload '${payload.toString()}'`);
  }
});

If the payload argument is not specified, the default payload will be the 64-bit timestamp (little endian) marking the start of the PING duration.

ping(
payload: ArrayBufferView,
callback: (
err: Error | null,
duration: number,
payload: Buffer,
) => void
,
): boolean
ref(): void

Calls ref() on this Http2Session instance's underlying net.Socket.

setLocalWindowSize(windowSize: number): void

Sets the local endpoint's window size. The windowSize is the total window size to set, not the delta.

import http2 from 'node:http2';

const server = http2.createServer();
const expectedWindowSize = 2 ** 20;
server.on('connect', (session) => {

  // Set local window size to be 2 ** 20
  session.setLocalWindowSize(expectedWindowSize);
});
setTimeout(
msecs: number,
callback?: () => void,
): void

Used to set a callback function that is called when there is no activity on the Http2Session after msecs milliseconds. The given callback is registered as a listener on the 'timeout' event.

settings(
settings: Settings,
callback?: (
err: Error | null,
settings: Settings,
duration: number,
) => void
,
): void

Updates the current local settings for this Http2Session and sends a new SETTINGS frame to the connected HTTP/2 peer.

Once called, the http2session.pendingSettingsAck property will be true while the session is waiting for the remote peer to acknowledge the new settings.

The new settings will not become effective until the SETTINGS acknowledgment is received and the 'localSettings' event is emitted. It is possible to send multiple SETTINGS frames while acknowledgment is still pending.

unref(): void

Calls unref() on this Http2Sessioninstance's underlying net.Socket.

addListener(
event: "close",
listener: () => void,
): this
addListener(
event: "error",
listener: (err: Error) => void,
): this
addListener(
event: "frameError",
listener: (
frameType: number,
errorCode: number,
streamID: number,
) => void
,
): this
addListener(
event: "goaway",
listener: (
errorCode: number,
lastStreamID: number,
opaqueData?: Buffer,
) => void
,
): this
addListener(
event: "localSettings",
listener: (settings: Settings) => void,
): this
addListener(
event: "ping",
listener: () => void,
): this
addListener(
event: "remoteSettings",
listener: (settings: Settings) => void,
): this
addListener(
event: "timeout",
listener: () => void,
): this
addListener(
event: string | symbol,
listener: (...args: any[]) => void,
): this
emit(event: "close"): boolean
emit(
event: "error",
err: Error,
): boolean
emit(
event: "frameError",
frameType: number,
errorCode: number,
streamID: number,
): boolean
emit(
event: "goaway",
errorCode: number,
lastStreamID: number,
opaqueData?: Buffer,
): boolean
emit(
event: "localSettings",
settings: Settings,
): boolean
emit(event: "ping"): boolean
emit(
event: "remoteSettings",
settings: Settings,
): boolean
emit(event: "timeout"): boolean
emit(
event: string | symbol,
...args: any[],
): boolean
on(
event: "close",
listener: () => void,
): this
on(
event: "error",
listener: (err: Error) => void,
): this
on(
event: "frameError",
listener: (
frameType: number,
errorCode: number,
streamID: number,
) => void
,
): this
on(
event: "goaway",
listener: (
errorCode: number,
lastStreamID: number,
opaqueData?: Buffer,
) => void
,
): this
on(
event: "localSettings",
listener: (settings: Settings) => void,
): this
on(
event: "ping",
listener: () => void,
): this
on(
event: "remoteSettings",
listener: (settings: Settings) => void,
): this
on(
event: "timeout",
listener: () => void,
): this
on(
event: string | symbol,
listener: (...args: any[]) => void,
): this
once(
event: "close",
listener: () => void,
): this
once(
event: "error",
listener: (err: Error) => void,
): this
once(
event: "frameError",
listener: (
frameType: number,
errorCode: number,
streamID: number,
) => void
,
): this
once(
event: "goaway",
listener: (
errorCode: number,
lastStreamID: number,
opaqueData?: Buffer,
) => void
,
): this
once(
event: "localSettings",
listener: (settings: Settings) => void,
): this
once(
event: "ping",
listener: () => void,
): this
once(
event: "remoteSettings",
listener: (settings: Settings) => void,
): this
once(
event: "timeout",
listener: () => void,
): this
once(
event: string | symbol,
listener: (...args: any[]) => void,
): this
prependListener(
event: "close",
listener: () => void,
): this
prependListener(
event: "error",
listener: (err: Error) => void,
): this
prependListener(
event: "frameError",
listener: (
frameType: number,
errorCode: number,
streamID: number,
) => void
,
): this
prependListener(
event: "goaway",
listener: (
errorCode: number,
lastStreamID: number,
opaqueData?: Buffer,
) => void
,
): this
prependListener(
event: "localSettings",
listener: (settings: Settings) => void,
): this
prependListener(
event: "ping",
listener: () => void,
): this
prependListener(
event: "remoteSettings",
listener: (settings: Settings) => void,
): this
prependListener(
event: "timeout",
listener: () => void,
): this
prependListener(
event: string | symbol,
listener: (...args: any[]) => void,
): this
prependOnceListener(
event: "close",
listener: () => void,
): this
prependOnceListener(
event: "error",
listener: (err: Error) => void,
): this
prependOnceListener(
event: "frameError",
listener: (
frameType: number,
errorCode: number,
streamID: number,
) => void
,
): this
prependOnceListener(
event: "goaway",
listener: (
errorCode: number,
lastStreamID: number,
opaqueData?: Buffer,
) => void
,
): this
prependOnceListener(
event: "localSettings",
listener: (settings: Settings) => void,
): this
prependOnceListener(
event: "ping",
listener: () => void,
): this
prependOnceListener(
event: "remoteSettings",
listener: (settings: Settings) => void,
): this
prependOnceListener(
event: "timeout",
listener: () => void,
): this
prependOnceListener(
event: string | symbol,
listener: (...args: any[]) => void,
): this

interface Http2Stream

extends [stream.Duplex]

Usage in Deno

import { type Http2Stream } from "node:http2";
Deno compatibility

The following methods are non-functional stubs:

  • aborted
  • bufferSize
  • endAfterHeaders
  • id
  • pending
  • priority
  • rstCode
  • sentHeaders
  • sentInfoHeaders
  • sentTrailers
  • state

Properties

aborted: boolean
readonly

Set to true if the Http2Stream instance was aborted abnormally. When set, the 'aborted' event will have been emitted.

bufferSize: number
readonly

This property shows the number of characters currently buffered to be written. See net.Socket.bufferSize for details.

closed: boolean
readonly

Set to true if the Http2Stream instance has been closed.

destroyed: boolean
readonly

Set to true if the Http2Stream instance has been destroyed and is no longer usable.

endAfterHeaders: boolean
readonly

Set to true if the END_STREAM flag was set in the request or response HEADERS frame received, indicating that no additional data should be received and the readable side of the Http2Stream will be closed.

id: number | undefined
readonly
optional

The numeric stream identifier of this Http2Stream instance. Set to undefined if the stream identifier has not yet been assigned.

pending: boolean
readonly

Set to true if the Http2Stream instance has not yet been assigned a numeric stream identifier.

rstCode: number
readonly

Set to the RST_STREAM error code reported when the Http2Stream is destroyed after either receiving an RST_STREAM frame from the connected peer, calling http2stream.close(), or http2stream.destroy(). Will be undefined if the Http2Stream has not been closed.

sentHeaders: OutgoingHttpHeaders
readonly

An object containing the outbound headers sent for this Http2Stream.

sentInfoHeaders: OutgoingHttpHeaders[] | undefined
readonly
optional

An array of objects containing the outbound informational (additional) headers sent for this Http2Stream.

sentTrailers: OutgoingHttpHeaders | undefined
readonly
optional

An object containing the outbound trailers sent for this HttpStream.

session: Http2Session | undefined
readonly

A reference to the Http2Session instance that owns this Http2Stream. The value will be undefined after the Http2Stream instance is destroyed.

state: StreamState
readonly

Provides miscellaneous information about the current state of the Http2Stream.

A current state of this Http2Stream.

Methods

close(
code?: number,
callback?: () => void,
): void

Closes the Http2Stream instance by sending an RST_STREAM frame to the connected HTTP/2 peer.

priority(options: StreamPriorityOptions): void

Updates the priority for this Http2Stream instance.

setTimeout(
msecs: number,
callback?: () => void,
): void
import http2 from 'node:http2';
const client = http2.connect('http://example.org:8000');
const { NGHTTP2_CANCEL } = http2.constants;
const req = client.request({ ':path': '/' });

// Cancel the stream if there's no activity after 5 seconds
req.setTimeout(5000, () => req.close(NGHTTP2_CANCEL));
sendTrailers(headers: OutgoingHttpHeaders): void

Sends a trailing HEADERS frame to the connected HTTP/2 peer. This method will cause the Http2Stream to be immediately closed and must only be called after the 'wantTrailers' event has been emitted. When sending a request or sending a response, the options.waitForTrailers option must be set in order to keep the Http2Stream open after the final DATA frame so that trailers can be sent.

import http2 from 'node:http2';
const server = http2.createServer();
server.on('stream', (stream) => {
  stream.respond(undefined, { waitForTrailers: true });
  stream.on('wantTrailers', () => {
    stream.sendTrailers({ xyz: 'abc' });
  });
  stream.end('Hello World');
});

The HTTP/1 specification forbids trailers from containing HTTP/2 pseudo-header fields (e.g. ':method', ':path', etc).

addListener(
event: "aborted",
listener: () => void,
): this
addListener(
event: "close",
listener: () => void,
): this
addListener(
event: "data",
listener: (chunk: Buffer | string) => void,
): this
addListener(
event: "drain",
listener: () => void,
): this
addListener(
event: "end",
listener: () => void,
): this
addListener(
event: "error",
listener: (err: Error) => void,
): this
addListener(
event: "finish",
listener: () => void,
): this
addListener(
event: "frameError",
listener: (
frameType: number,
errorCode: number,
) => void
,
): this
addListener(
event: "pipe",
listener: (src: stream.Readable) => void,
): this
addListener(
event: "unpipe",
listener: (src: stream.Readable) => void,
): this
addListener(
event: "streamClosed",
listener: (code: number) => void,
): this
addListener(
event: "timeout",
listener: () => void,
): this
addListener(
event: "trailers",
listener: (
trailers: IncomingHttpHeaders,
flags: number,
) => void
,
): this
addListener(
event: "wantTrailers",
listener: () => void,
): this
addListener(
event: string | symbol,
listener: (...args: any[]) => void,
): this
emit(event: "aborted"): boolean
emit(event: "close"): boolean
emit(
event: "data",
chunk: Buffer | string,
): boolean
emit(event: "drain"): boolean
emit(event: "end"): boolean
emit(
event: "error",
err: Error,
): boolean
emit(event: "finish"): boolean
emit(
event: "frameError",
frameType: number,
errorCode: number,
): boolean
emit(
event: "pipe",
src: stream.Readable,
): boolean
emit(
event: "unpipe",
src: stream.Readable,
): boolean
emit(
event: "streamClosed",
code: number,
): boolean
emit(event: "timeout"): boolean
emit(
event: "trailers",
trailers: IncomingHttpHeaders,
flags: number,
): boolean
emit(event: "wantTrailers"): boolean
emit(
event: string | symbol,
...args: any[],
): boolean
on(
event: "aborted",
listener: () => void,
): this
on(
event: "close",
listener: () => void,
): this
on(
event: "data",
listener: (chunk: Buffer | string) => void,
): this
on(
event: "drain",
listener: () => void,
): this
on(
event: "end",
listener: () => void,
): this
on(
event: "error",
listener: (err: Error) => void,
): this
on(
event: "finish",
listener: () => void,
): this
on(
event: "frameError",
listener: (
frameType: number,
errorCode: number,
) => void
,
): this
on(
event: "pipe",
listener: (src: stream.Readable) => void,
): this
on(
event: "unpipe",
listener: (src: stream.Readable) => void,
): this
on(
event: "streamClosed",
listener: (code: number) => void,
): this
on(
event: "timeout",
listener: () => void,
): this
on(
event: "trailers",
listener: (
trailers: IncomingHttpHeaders,
flags: number,
) => void
,
): this
on(
event: "wantTrailers",
listener: () => void,
): this
on(
event: string | symbol,
listener: (...args: any[]) => void,
): this
once(
event: "aborted",
listener: () => void,
): this
once(
event: "close",
listener: () => void,
): this
once(
event: "data",
listener: (chunk: Buffer | string) => void,
): this
once(
event: "drain",
listener: () => void,
): this
once(
event: "end",
listener: () => void,
): this
once(
event: "error",
listener: (err: Error) => void,
): this
once(
event: "finish",
listener: () => void,
): this
once(
event: "frameError",
listener: (
frameType: number,
errorCode: number,
) => void
,
): this
once(
event: "pipe",
listener: (src: stream.Readable) => void,
): this
once(
event: "unpipe",
listener: (src: stream.Readable) => void,
): this
once(
event: "streamClosed",
listener: (code: number) => void,
): this
once(
event: "timeout",
listener: () => void,
): this
once(
event: "trailers",
listener: (
trailers: IncomingHttpHeaders,
flags: number,
) => void
,
): this
once(
event: "wantTrailers",
listener: () => void,
): this
once(
event: string | symbol,
listener: (...args: any[]) => void,
): this
prependListener(
event: "aborted",
listener: () => void,
): this
prependListener(
event: "close",
listener: () => void,
): this
prependListener(
event: "data",
listener: (chunk: Buffer | string) => void,
): this
prependListener(
event: "drain",
listener: () => void,
): this
prependListener(
event: "end",
listener: () => void,
): this
prependListener(
event: "error",
listener: (err: Error) => void,
): this
prependListener(
event: "finish",
listener: () => void,
): this
prependListener(
event: "frameError",
listener: (
frameType: number,
errorCode: number,
) => void
,
): this
prependListener(
event: "pipe",
listener: (src: stream.Readable) => void,
): this
prependListener(
event: "unpipe",
listener: (src: stream.Readable) => void,
): this
prependListener(
event: "streamClosed",
listener: (code: number) => void,
): this
prependListener(
event: "timeout",
listener: () => void,
): this
prependListener(
event: "trailers",
listener: (
trailers: IncomingHttpHeaders,
flags: number,
) => void
,
): this
prependListener(
event: "wantTrailers",
listener: () => void,
): this
prependListener(
event: string | symbol,
listener: (...args: any[]) => void,
): this
prependOnceListener(
event: "aborted",
listener: () => void,
): this
prependOnceListener(
event: "close",
listener: () => void,
): this
prependOnceListener(
event: "data",
listener: (chunk: Buffer | string) => void,
): this
prependOnceListener(
event: "drain",
listener: () => void,
): this
prependOnceListener(
event: "end",
listener: () => void,
): this
prependOnceListener(
event: "error",
listener: (err: Error) => void,
): this
prependOnceListener(
event: "finish",
listener: () => void,
): this
prependOnceListener(
event: "frameError",
listener: (
frameType: number,
errorCode: number,
) => void
,
): this
prependOnceListener(
event: "pipe",
listener: (src: stream.Readable) => void,
): this
prependOnceListener(
event: "unpipe",
listener: (src: stream.Readable) => void,
): this
prependOnceListener(
event: "streamClosed",
listener: (code: number) => void,
): this
prependOnceListener(
event: "timeout",
listener: () => void,
): this
prependOnceListener(
event: "trailers",
listener: (
trailers: IncomingHttpHeaders,
flags: number,
) => void
,
): this
prependOnceListener(
event: "wantTrailers",
listener: () => void,
): this
prependOnceListener(
event: string | symbol,
listener: (...args: any[]) => void,
): this

interface IncomingHttpHeaders

extends Http1IncomingHttpHeaders

Usage in Deno

import { type IncomingHttpHeaders } from "node:http2";

Properties

:path: string | undefined
optional
:method: string | undefined
optional
:authority: string | undefined
optional
:scheme: string | undefined
optional

interface IncomingHttpStatusHeader

Usage in Deno

import { type IncomingHttpStatusHeader } from "node:http2";

Properties

:status: number | undefined
optional

interface OutgoingHttpHeaders

extends [NodeJS.Dict]<OutgoingHttpHeader>

Usage in Deno

import { type OutgoingHttpHeaders } from "node:http2";

Properties

accept:
string
| string[]
| undefined
optional
accept-charset:
string
| string[]
| undefined
optional
accept-encoding:
string
| string[]
| undefined
optional
accept-language:
string
| string[]
| undefined
optional
accept-ranges: string | undefined
optional
access-control-allow-credentials: string | undefined
optional
access-control-allow-headers: string | undefined
optional
access-control-allow-methods: string | undefined
optional
access-control-allow-origin: string | undefined
optional
access-control-expose-headers: string | undefined
optional
access-control-max-age: string | undefined
optional
access-control-request-headers: string | undefined
optional
access-control-request-method: string | undefined
optional
age: string | undefined
optional
allow: string | undefined
optional
authorization: string | undefined
optional
cache-control: string | undefined
optional
cdn-cache-control: string | undefined
optional
connection:
string
| string[]
| undefined
optional
content-disposition: string | undefined
optional
content-encoding: string | undefined
optional
content-language: string | undefined
optional
content-length:
string
| number
| undefined
optional
content-location: string | undefined
optional
content-range: string | undefined
optional
content-security-policy: string | undefined
optional
content-security-policy-report-only: string | undefined
optional
content-type: string | undefined
optional
cookie:
string
| string[]
| undefined
optional
dav:
string
| string[]
| undefined
optional
dnt: string | undefined
optional
date: string | undefined
optional
etag: string | undefined
optional
expect: string | undefined
optional
expires: string | undefined
optional
forwarded: string | undefined
optional
from: string | undefined
optional
host: string | undefined
optional
if-match: string | undefined
optional
if-modified-since: string | undefined
optional
if-none-match: string | undefined
optional
if-range: string | undefined
optional
if-unmodified-since: string | undefined
optional
last-modified: string | undefined
optional
link:
string
| string[]
| undefined
optional
location: string | undefined
optional
max-forwards: string | undefined
optional
origin: string | undefined
optional
pragma:
string
| string[]
| undefined
optional
proxy-authenticate:
string
| string[]
| undefined
optional
proxy-authorization: string | undefined
optional
public-key-pins: string | undefined
optional
public-key-pins-report-only: string | undefined
optional
range: string | undefined
optional
referer: string | undefined
optional
referrer-policy: string | undefined
optional
refresh: string | undefined
optional
retry-after: string | undefined
optional
sec-websocket-accept: string | undefined
optional
sec-websocket-extensions:
string
| string[]
| undefined
optional
sec-websocket-key: string | undefined
optional
sec-websocket-protocol:
string
| string[]
| undefined
optional
sec-websocket-version: string | undefined
optional
server: string | undefined
optional
set-cookie:
string
| string[]
| undefined
optional
strict-transport-security: string | undefined
optional
te: string | undefined
optional
trailer: string | undefined
optional
transfer-encoding: string | undefined
optional
user-agent: string | undefined
optional
upgrade: string | undefined
optional
upgrade-insecure-requests: string | undefined
optional
vary: string | undefined
optional
via:
string
| string[]
| undefined
optional
warning: string | undefined
optional
www-authenticate:
string
| string[]
| undefined
optional
x-content-type-options: string | undefined
optional
x-dns-prefetch-control: string | undefined
optional
x-frame-options: string | undefined
optional
x-xss-protection: string | undefined
optional

interface SecureClientSessionOptions

extends ClientSessionOptions[tls.ConnectionOptions]

Usage in Deno

import { type SecureClientSessionOptions } from "node:http2";

interface SecureServerOptions

extends SecureServerSessionOptions<Http1Request, Http1Response, Http2Request, Http2Response>

Usage in Deno

import { type SecureServerOptions } from "node:http2";

Type Parameters

Http1Request extends IncomingMessage = IncomingMessage
Http1Response extends ServerResponse = ServerResponse
Http2Request extends Http2ServerRequest = Http2ServerRequest
Http2Response extends Http2ServerResponse = Http2ServerResponse

Properties

allowHTTP1: boolean | undefined
optional
origins: string[] | undefined
optional

interface SecureServerSessionOptions

extends ServerSessionOptions<Http1Request, Http1Response, Http2Request, Http2Response>[tls.TlsOptions]

Usage in Deno

import { type SecureServerSessionOptions } from "node:http2";

Type Parameters

Http1Request extends IncomingMessage = IncomingMessage
Http1Response extends ServerResponse = ServerResponse
Http2Request extends Http2ServerRequest = Http2ServerRequest
Http2Response extends Http2ServerResponse = Http2ServerResponse

interface ServerHttp2Session

extends Http2Session

Usage in Deno

import { type ServerHttp2Session } from "node:http2";
Deno compatibility

All methods are non-functional stubs.

Type Parameters

Http1Request extends IncomingMessage = IncomingMessage
Http1Response extends ServerResponse = ServerResponse
Http2Request extends Http2ServerRequest = Http2ServerRequest
Http2Response extends Http2ServerResponse = Http2ServerResponse

Properties

server: Http2Server<Http1Request, Http1Response, Http2Request, Http2Response> | Http2SecureServer<Http1Request, Http1Response, Http2Request, Http2Response>
readonly

Methods

altsvc(
alt: string,
originOrStream:
number
| string
| url.URL
| AlternativeServiceOptions
,
): void

Submits an ALTSVC frame (as defined by RFC 7838) to the connected client.

import http2 from 'node:http2';

const server = http2.createServer();
server.on('session', (session) => {
  // Set altsvc for origin https://example.org:80
  session.altsvc('h2=":8000"', 'https://example.org:80');
});

server.on('stream', (stream) => {
  // Set altsvc for a specific stream
  stream.session.altsvc('h2=":8000"', stream.id);
});

Sending an ALTSVC frame with a specific stream ID indicates that the alternate service is associated with the origin of the given Http2Stream.

The alt and origin string must contain only ASCII bytes and are strictly interpreted as a sequence of ASCII bytes. The special value 'clear'may be passed to clear any previously set alternative service for a given domain.

When a string is passed for the originOrStream argument, it will be parsed as a URL and the origin will be derived. For instance, the origin for the HTTP URL 'https://example.org/foo/bar' is the ASCII string'https://example.org'. An error will be thrown if either the given string cannot be parsed as a URL or if a valid origin cannot be derived.

A URL object, or any object with an origin property, may be passed asoriginOrStream, in which case the value of the origin property will be used. The value of the origin property must be a properly serialized ASCII origin.

origin(...origins: Array<
string
| url.URL
| { origin: string; }
>
): void

Submits an ORIGIN frame (as defined by RFC 8336) to the connected client to advertise the set of origins for which the server is capable of providing authoritative responses.

import http2 from 'node:http2';
const options = getSecureOptionsSomehow();
const server = http2.createSecureServer(options);
server.on('stream', (stream) => {
  stream.respond();
  stream.end('ok');
});
server.on('session', (session) => {
  session.origin('https://example.com', 'https://example.org');
});

When a string is passed as an origin, it will be parsed as a URL and the origin will be derived. For instance, the origin for the HTTP URL 'https://example.org/foo/bar' is the ASCII string 'https://example.org'. An error will be thrown if either the given string cannot be parsed as a URL or if a valid origin cannot be derived.

A URL object, or any object with an origin property, may be passed as an origin, in which case the value of the origin property will be used. The value of the origin property must be a properly serialized ASCII origin.

Alternatively, the origins option may be used when creating a new HTTP/2 server using the http2.createSecureServer() method:

import http2 from 'node:http2';
const options = getSecureOptionsSomehow();
options.origins = ['https://example.com', 'https://example.org'];
const server = http2.createSecureServer(options);
server.on('stream', (stream) => {
  stream.respond();
  stream.end('ok');
});
addListener(
event: "connect",
listener: (
session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>,
socket: net.Socket | tls.TLSSocket,
) => void
,
): this
addListener(
event: "stream",
listener: (
stream: ServerHttp2Stream,
headers: IncomingHttpHeaders,
flags: number,
) => void
,
): this
addListener(
event: string | symbol,
listener: (...args: any[]) => void,
): this
emit(
event: "connect",
session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>,
socket: net.Socket | tls.TLSSocket,
): boolean
emit(
event: "stream",
stream: ServerHttp2Stream,
headers: IncomingHttpHeaders,
flags: number,
): boolean
emit(
event: string | symbol,
...args: any[],
): boolean
on(
event: "connect",
listener: (
session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>,
socket: net.Socket | tls.TLSSocket,
) => void
,
): this
on(
event: "stream",
listener: (
stream: ServerHttp2Stream,
headers: IncomingHttpHeaders,
flags: number,
) => void
,
): this
on(
event: string | symbol,
listener: (...args: any[]) => void,
): this
once(
event: "connect",
listener: (
session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>,
socket: net.Socket | tls.TLSSocket,
) => void
,
): this
once(
event: "stream",
listener: (
stream: ServerHttp2Stream,
headers: IncomingHttpHeaders,
flags: number,
) => void
,
): this
once(
event: string | symbol,
listener: (...args: any[]) => void,
): this
prependListener(
event: "connect",
listener: (
session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>,
socket: net.Socket | tls.TLSSocket,
) => void
,
): this
prependListener(
event: "stream",
listener: (
stream: ServerHttp2Stream,
headers: IncomingHttpHeaders,
flags: number,
) => void
,
): this
prependListener(
event: string | symbol,
listener: (...args: any[]) => void,
): this
prependOnceListener(
event: "connect",
listener: (
session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>,
socket: net.Socket | tls.TLSSocket,
) => void
,
): this
prependOnceListener(
event: "stream",
listener: (
stream: ServerHttp2Stream,
headers: IncomingHttpHeaders,
flags: number,
) => void
,
): this
prependOnceListener(
event: string | symbol,
listener: (...args: any[]) => void,
): this

interface ServerHttp2Stream

extends Http2Stream

Usage in Deno

import { type ServerHttp2Stream } from "node:http2";

Properties

headersSent: boolean
readonly

True if headers were sent, false otherwise (read-only).

pushAllowed: boolean
readonly

Read-only property mapped to the SETTINGS_ENABLE_PUSH flag of the remote client's most recent SETTINGS frame. Will be true if the remote peer accepts push streams, false otherwise. Settings are the same for every Http2Stream in the same Http2Session.

Methods

additionalHeaders(headers: OutgoingHttpHeaders): void

Sends an additional informational HEADERS frame to the connected HTTP/2 peer.

pushStream(
headers: OutgoingHttpHeaders,
callback?: (
err: Error | null,
pushStream: ServerHttp2Stream,
headers: OutgoingHttpHeaders,
) => void
,
): void

Initiates a push stream. The callback is invoked with the new Http2Stream instance created for the push stream passed as the second argument, or an Error passed as the first argument.

import http2 from 'node:http2';
const server = http2.createServer();
server.on('stream', (stream) => {
  stream.respond({ ':status': 200 });
  stream.pushStream({ ':path': '/' }, (err, pushStream, headers) => {
    if (err) throw err;
    pushStream.respond({ ':status': 200 });
    pushStream.end('some pushed data');
  });
  stream.end('some data');
});

Setting the weight of a push stream is not allowed in the HEADERS frame. Pass a weight value to http2stream.priority with the silent option set to true to enable server-side bandwidth balancing between concurrent streams.

Calling http2stream.pushStream() from within a pushed stream is not permitted and will throw an error.

pushStream(
headers: OutgoingHttpHeaders,
options?: StreamPriorityOptions,
callback?: (
err: Error | null,
pushStream: ServerHttp2Stream,
headers: OutgoingHttpHeaders,
) => void
,
): void
respond(
headers?: OutgoingHttpHeaders,
options?: ServerStreamResponseOptions,
): void
import http2 from 'node:http2';
const server = http2.createServer();
server.on('stream', (stream) => {
  stream.respond({ ':status': 200 });
  stream.end('some data');
});

Initiates a response. When the options.waitForTrailers option is set, the 'wantTrailers' event will be emitted immediately after queuing the last chunk of payload data to be sent. The http2stream.sendTrailers() method can then be used to send trailing header fields to the peer.

When options.waitForTrailers is set, the Http2Stream will not automatically close when the final DATA frame is transmitted. User code must call either http2stream.sendTrailers() or http2stream.close() to close the Http2Stream.

import http2 from 'node:http2';
const server = http2.createServer();
server.on('stream', (stream) => {
  stream.respond({ ':status': 200 }, { waitForTrailers: true });
  stream.on('wantTrailers', () => {
    stream.sendTrailers({ ABC: 'some value to send' });
  });
  stream.end('some data');
});
respondWithFD(
fd: number | fs.promises.FileHandle,
headers?: OutgoingHttpHeaders,
options?: ServerStreamFileResponseOptions,
): void

Initiates a response whose data is read from the given file descriptor. No validation is performed on the given file descriptor. If an error occurs while attempting to read data using the file descriptor, the Http2Stream will be closed using an RST_STREAM frame using the standard INTERNAL_ERROR code.

When used, the Http2Stream object's Duplex interface will be closed automatically.

import http2 from 'node:http2';
import fs from 'node:fs';

const server = http2.createServer();
server.on('stream', (stream) => {
  const fd = fs.openSync('/some/file', 'r');

  const stat = fs.fstatSync(fd);
  const headers = {
    'content-length': stat.size,
    'last-modified': stat.mtime.toUTCString(),
    'content-type': 'text/plain; charset=utf-8',
  };
  stream.respondWithFD(fd, headers);
  stream.on('close', () => fs.closeSync(fd));
});

The optional options.statCheck function may be specified to give user code an opportunity to set additional content headers based on the fs.Stat details of the given fd. If the statCheck function is provided, the http2stream.respondWithFD() method will perform an fs.fstat() call to collect details on the provided file descriptor.

The offset and length options may be used to limit the response to a specific range subset. This can be used, for instance, to support HTTP Range requests.

The file descriptor or FileHandle is not closed when the stream is closed, so it will need to be closed manually once it is no longer needed. Using the same file descriptor concurrently for multiple streams is not supported and may result in data loss. Re-using a file descriptor after a stream has finished is supported.

When the options.waitForTrailers option is set, the 'wantTrailers' event will be emitted immediately after queuing the last chunk of payload data to be sent. The http2stream.sendTrailers() method can then be used to sent trailing header fields to the peer.

When options.waitForTrailers is set, the Http2Stream will not automatically close when the final DATA frame is transmitted. User code must call either http2stream.sendTrailers() or http2stream.close() to close the Http2Stream.

import http2 from 'node:http2';
import fs from 'node:fs';

const server = http2.createServer();
server.on('stream', (stream) => {
  const fd = fs.openSync('/some/file', 'r');

  const stat = fs.fstatSync(fd);
  const headers = {
    'content-length': stat.size,
    'last-modified': stat.mtime.toUTCString(),
    'content-type': 'text/plain; charset=utf-8',
  };
  stream.respondWithFD(fd, headers, { waitForTrailers: true });
  stream.on('wantTrailers', () => {
    stream.sendTrailers({ ABC: 'some value to send' });
  });

  stream.on('close', () => fs.closeSync(fd));
});
respondWithFile(
path: string,
headers?: OutgoingHttpHeaders,
options?: ServerStreamFileResponseOptionsWithError,
): void

Sends a regular file as the response. The path must specify a regular file or an 'error' event will be emitted on the Http2Stream object.

When used, the Http2Stream object's Duplex interface will be closed automatically.

The optional options.statCheck function may be specified to give user code an opportunity to set additional content headers based on the fs.Stat details of the given file:

If an error occurs while attempting to read the file data, the Http2Stream will be closed using an RST_STREAM frame using the standard INTERNAL_ERROR code. If the onError callback is defined, then it will be called. Otherwise, the stream will be destroyed.

Example using a file path:

import http2 from 'node:http2';
const server = http2.createServer();
server.on('stream', (stream) => {
  function statCheck(stat, headers) {
    headers['last-modified'] = stat.mtime.toUTCString();
  }

  function onError(err) {
    // stream.respond() can throw if the stream has been destroyed by
    // the other side.
    try {
      if (err.code === 'ENOENT') {
        stream.respond({ ':status': 404 });
      } else {
        stream.respond({ ':status': 500 });
      }
    } catch (err) {
      // Perform actual error handling.
      console.error(err);
    }
    stream.end();
  }

  stream.respondWithFile('/some/file',
                         { 'content-type': 'text/plain; charset=utf-8' },
                         { statCheck, onError });
});

The options.statCheck function may also be used to cancel the send operation by returning false. For instance, a conditional request may check the stat results to determine if the file has been modified to return an appropriate 304 response:

import http2 from 'node:http2';
const server = http2.createServer();
server.on('stream', (stream) => {
  function statCheck(stat, headers) {
    // Check the stat here...
    stream.respond({ ':status': 304 });
    return false; // Cancel the send operation
  }
  stream.respondWithFile('/some/file',
                         { 'content-type': 'text/plain; charset=utf-8' },
                         { statCheck });
});

The content-length header field will be automatically set.

The offset and length options may be used to limit the response to a specific range subset. This can be used, for instance, to support HTTP Range requests.

The options.onError function may also be used to handle all the errors that could happen before the delivery of the file is initiated. The default behavior is to destroy the stream.

When the options.waitForTrailers option is set, the 'wantTrailers' event will be emitted immediately after queuing the last chunk of payload data to be sent. The http2stream.sendTrailers() method can then be used to sent trailing header fields to the peer.

When options.waitForTrailers is set, the Http2Stream will not automatically close when the final DATA frame is transmitted. User code must call eitherhttp2stream.sendTrailers() or http2stream.close() to close theHttp2Stream.

import http2 from 'node:http2';
const server = http2.createServer();
server.on('stream', (stream) => {
  stream.respondWithFile('/some/file',
                         { 'content-type': 'text/plain; charset=utf-8' },
                         { waitForTrailers: true });
  stream.on('wantTrailers', () => {
    stream.sendTrailers({ ABC: 'some value to send' });
  });
});

interface ServerOptions

extends ServerSessionOptions<Http1Request, Http1Response, Http2Request, Http2Response>

Usage in Deno

import { type ServerOptions } from "node:http2";

Type Parameters

Http1Request extends IncomingMessage = IncomingMessage
Http1Response extends ServerResponse = ServerResponse
Http2Request extends Http2ServerRequest = Http2ServerRequest
Http2Response extends Http2ServerResponse = Http2ServerResponse

Properties

streamResetBurst: number | undefined
optional
streamResetRate: number | undefined
optional

interface ServerSessionOptions

extends SessionOptions

Usage in Deno

import { type ServerSessionOptions } from "node:http2";

Type Parameters

Http1Request extends IncomingMessage = IncomingMessage
Http1Response extends ServerResponse = ServerResponse
Http2Request extends Http2ServerRequest = Http2ServerRequest
Http2Response extends Http2ServerResponse = Http2ServerResponse

Properties

Http1IncomingMessage: Http1Request | undefined
optional
Http1ServerResponse: Http1Response | undefined
optional
Http2ServerRequest: Http2Request | undefined
optional
Http2ServerResponse: Http2Response | undefined
optional

interface ServerStreamFileResponseOptions

Usage in Deno

import { type ServerStreamFileResponseOptions } from "node:http2";

Properties

waitForTrailers: boolean | undefined
optional
offset: number | undefined
optional
length: number | undefined
optional

Methods

statCheck(
stats: fs.Stats,
headers: OutgoingHttpHeaders,
statOptions: StatOptions,
): void | boolean
optional

interface ServerStreamFileResponseOptionsWithError

extends ServerStreamFileResponseOptions

Usage in Deno

import { type ServerStreamFileResponseOptionsWithError } from "node:http2";

Methods

onError(err: ErrnoException): void
optional

interface ServerStreamResponseOptions

Usage in Deno

import { type ServerStreamResponseOptions } from "node:http2";

Properties

endStream: boolean | undefined
optional
waitForTrailers: boolean | undefined
optional

interface SessionOptions

Usage in Deno

import { type SessionOptions } from "node:http2";

Properties

maxDeflateDynamicTableSize: number | undefined
optional
maxSessionMemory: number | undefined
optional
maxHeaderListPairs: number | undefined
optional
maxOutstandingPings: number | undefined
optional
maxSendHeaderBlockLength: number | undefined
optional
paddingStrategy: number | undefined
optional
peerMaxConcurrentStreams: number | undefined
optional
settings: Settings | undefined
optional
remoteCustomSettings: number[] | undefined
optional
unknownProtocolTimeout: number | undefined
optional

Specifies a timeout in milliseconds that a server should wait when an ['unknownProtocol'][] is emitted. If the socket has not been destroyed by that time the server will destroy it.

Methods

selectPadding(
frameLen: number,
maxFrameLen: number,
): number
optional

interface SessionState

Usage in Deno

import { type SessionState } from "node:http2";

Properties

effectiveLocalWindowSize: number | undefined
optional
effectiveRecvDataLength: number | undefined
optional
nextStreamID: number | undefined
optional
localWindowSize: number | undefined
optional
lastProcStreamID: number | undefined
optional
remoteWindowSize: number | undefined
optional
outboundQueueSize: number | undefined
optional
deflateDynamicTableSize: number | undefined
optional
inflateDynamicTableSize: number | undefined
optional

interface Settings

Usage in Deno

import { type Settings } from "node:http2";

Properties

headerTableSize: number | undefined
optional
enablePush: boolean | undefined
optional
initialWindowSize: number | undefined
optional
maxFrameSize: number | undefined
optional
maxConcurrentStreams: number | undefined
optional
maxHeaderListSize: number | undefined
optional
enableConnectProtocol: boolean | undefined
optional

interface StatOptions

Usage in Deno

import { type StatOptions } from "node:http2";

Properties

offset: number
length: number

interface StreamPriorityOptions

Usage in Deno

import { type StreamPriorityOptions } from "node:http2";

Properties

exclusive: boolean | undefined
optional
parent: number | undefined
optional
weight: number | undefined
optional
silent: boolean | undefined
optional

interface StreamState

Usage in Deno

import { type StreamState } from "node:http2";

Properties

localWindowSize: number | undefined
optional
state: number | undefined
optional
localClose: number | undefined
optional
remoteClose: number | undefined
optional
sumDependencyWeight: number | undefined
optional
weight: number | undefined
optional

namespace constants

Usage in Deno

import { constants } from "node:http2";

Variables

constants.DEFAULT_SETTINGS_ENABLE_PUSH
No documentation available
constants.DEFAULT_SETTINGS_HEADER_TABLE_SIZE
No documentation available
constants.DEFAULT_SETTINGS_INITIAL_WINDOW_SIZE
No documentation available
constants.DEFAULT_SETTINGS_MAX_FRAME_SIZE
No documentation available
constants.HTTP2_HEADER_ACCEPT
No documentation available
constants.HTTP2_HEADER_ACCEPT_CHARSET
No documentation available
constants.HTTP2_HEADER_ACCEPT_ENCODING
No documentation available
constants.HTTP2_HEADER_ACCEPT_LANGUAGE
No documentation available
constants.HTTP2_HEADER_ACCEPT_RANGES
No documentation available
constants.HTTP2_HEADER_ACCESS_CONTROL_ALLOW_CREDENTIALS
No documentation available
constants.HTTP2_HEADER_ACCESS_CONTROL_ALLOW_HEADERS
No documentation available
constants.HTTP2_HEADER_ACCESS_CONTROL_ALLOW_METHODS
No documentation available
constants.HTTP2_HEADER_ACCESS_CONTROL_ALLOW_ORIGIN
No documentation available
constants.HTTP2_HEADER_ACCESS_CONTROL_EXPOSE_HEADERS
No documentation available
constants.HTTP2_HEADER_ACCESS_CONTROL_REQUEST_HEADERS
No documentation available
constants.HTTP2_HEADER_ACCESS_CONTROL_REQUEST_METHOD
No documentation available
constants.HTTP2_HEADER_AGE
No documentation available
constants.HTTP2_HEADER_ALLOW
No documentation available
constants.HTTP2_HEADER_AUTHORITY
No documentation available
constants.HTTP2_HEADER_AUTHORIZATION
No documentation available
constants.HTTP2_HEADER_CACHE_CONTROL
No documentation available
constants.HTTP2_HEADER_CONNECTION
No documentation available
constants.HTTP2_HEADER_CONTENT_DISPOSITION
No documentation available
constants.HTTP2_HEADER_CONTENT_ENCODING
No documentation available
constants.HTTP2_HEADER_CONTENT_LANGUAGE
No documentation available
constants.HTTP2_HEADER_CONTENT_LENGTH
No documentation available
constants.HTTP2_HEADER_CONTENT_LOCATION
No documentation available
constants.HTTP2_HEADER_CONTENT_MD5
No documentation available
constants.HTTP2_HEADER_CONTENT_RANGE
No documentation available
constants.HTTP2_HEADER_CONTENT_TYPE
No documentation available
constants.HTTP2_HEADER_COOKIE
No documentation available
constants.HTTP2_HEADER_DATE
No documentation available
constants.HTTP2_HEADER_ETAG
No documentation available
constants.HTTP2_HEADER_EXPECT
No documentation available
constants.HTTP2_HEADER_EXPIRES
No documentation available
constants.HTTP2_HEADER_FROM
No documentation available
constants.HTTP2_HEADER_HOST
No documentation available
constants.HTTP2_HEADER_HTTP2_SETTINGS
No documentation available
constants.HTTP2_HEADER_IF_MATCH
No documentation available
constants.HTTP2_HEADER_IF_MODIFIED_SINCE
No documentation available
constants.HTTP2_HEADER_IF_NONE_MATCH
No documentation available
constants.HTTP2_HEADER_IF_RANGE
No documentation available
constants.HTTP2_HEADER_IF_UNMODIFIED_SINCE
No documentation available
constants.HTTP2_HEADER_KEEP_ALIVE
No documentation available
constants.HTTP2_HEADER_LAST_MODIFIED
No documentation available
constants.HTTP2_HEADER_LINK
No documentation available
constants.HTTP2_HEADER_LOCATION
No documentation available
constants.HTTP2_HEADER_MAX_FORWARDS
No documentation available
constants.HTTP2_HEADER_METHOD
No documentation available
constants.HTTP2_HEADER_PATH
No documentation available
constants.HTTP2_HEADER_PREFER
No documentation available
constants.HTTP2_HEADER_PROXY_AUTHENTICATE
No documentation available
constants.HTTP2_HEADER_PROXY_AUTHORIZATION
No documentation available
constants.HTTP2_HEADER_PROXY_CONNECTION
No documentation available
constants.HTTP2_HEADER_RANGE
No documentation available
constants.HTTP2_HEADER_REFERER
No documentation available
constants.HTTP2_HEADER_REFRESH
No documentation available
constants.HTTP2_HEADER_RETRY_AFTER
No documentation available
constants.HTTP2_HEADER_SCHEME
No documentation available
constants.HTTP2_HEADER_SERVER
No documentation available
constants.HTTP2_HEADER_SET_COOKIE
No documentation available
constants.HTTP2_HEADER_STATUS
No documentation available
constants.HTTP2_HEADER_STRICT_TRANSPORT_SECURITY
No documentation available
constants.HTTP2_HEADER_TE
No documentation available
constants.HTTP2_HEADER_TRANSFER_ENCODING
No documentation available
constants.HTTP2_HEADER_UPGRADE
No documentation available
constants.HTTP2_HEADER_USER_AGENT
No documentation available
constants.HTTP2_HEADER_VARY
No documentation available
constants.HTTP2_HEADER_VIA
No documentation available
constants.HTTP2_HEADER_WWW_AUTHENTICATE
No documentation available
constants.HTTP2_METHOD_ACL
No documentation available
constants.HTTP2_METHOD_BASELINE_CONTROL
No documentation available
constants.HTTP2_METHOD_BIND
No documentation available
constants.HTTP2_METHOD_CHECKIN
No documentation available
constants.HTTP2_METHOD_CHECKOUT
No documentation available
constants.HTTP2_METHOD_CONNECT
No documentation available
constants.HTTP2_METHOD_COPY
No documentation available
constants.HTTP2_METHOD_DELETE
No documentation available
constants.HTTP2_METHOD_GET
No documentation available
constants.HTTP2_METHOD_HEAD
No documentation available
constants.HTTP2_METHOD_LABEL
No documentation available
constants.HTTP2_METHOD_LINK
No documentation available
constants.HTTP2_METHOD_LOCK
No documentation available
constants.HTTP2_METHOD_MERGE
No documentation available
constants.HTTP2_METHOD_MKACTIVITY
No documentation available
constants.HTTP2_METHOD_MKCALENDAR
No documentation available
constants.HTTP2_METHOD_MKCOL
No documentation available
constants.HTTP2_METHOD_MKREDIRECTREF
No documentation available
constants.HTTP2_METHOD_MKWORKSPACE
No documentation available
constants.HTTP2_METHOD_MOVE
No documentation available
constants.HTTP2_METHOD_OPTIONS
No documentation available
constants.HTTP2_METHOD_ORDERPATCH
No documentation available
constants.HTTP2_METHOD_PATCH
No documentation available
constants.HTTP2_METHOD_POST
No documentation available
constants.HTTP2_METHOD_PRI
No documentation available
constants.HTTP2_METHOD_PROPFIND
No documentation available
constants.HTTP2_METHOD_PROPPATCH
No documentation available
constants.HTTP2_METHOD_PUT
No documentation available
constants.HTTP2_METHOD_REBIND
No documentation available
constants.HTTP2_METHOD_REPORT
No documentation available
constants.HTTP2_METHOD_SEARCH
No documentation available
constants.HTTP2_METHOD_TRACE
No documentation available
constants.HTTP2_METHOD_UNBIND
No documentation available
constants.HTTP2_METHOD_UNCHECKOUT
No documentation available
constants.HTTP2_METHOD_UNLINK
No documentation available
constants.HTTP2_METHOD_UNLOCK
No documentation available
constants.HTTP2_METHOD_UPDATE
No documentation available
constants.HTTP2_METHOD_UPDATEREDIRECTREF
No documentation available
constants.HTTP2_METHOD_VERSION_CONTROL
No documentation available
constants.HTTP_STATUS_ACCEPTED
No documentation available
constants.HTTP_STATUS_ALREADY_REPORTED
No documentation available
constants.HTTP_STATUS_BAD_GATEWAY
No documentation available
constants.HTTP_STATUS_BAD_REQUEST
No documentation available
constants.HTTP_STATUS_BANDWIDTH_LIMIT_EXCEEDED
No documentation available
constants.HTTP_STATUS_CONFLICT
No documentation available
constants.HTTP_STATUS_CONTINUE
No documentation available
constants.HTTP_STATUS_CREATED
No documentation available
constants.HTTP_STATUS_EXPECTATION_FAILED
No documentation available
constants.HTTP_STATUS_FAILED_DEPENDENCY
No documentation available
constants.HTTP_STATUS_FORBIDDEN
No documentation available
constants.HTTP_STATUS_FOUND
No documentation available
constants.HTTP_STATUS_GATEWAY_TIMEOUT
No documentation available
constants.HTTP_STATUS_GONE
No documentation available
constants.HTTP_STATUS_HTTP_VERSION_NOT_SUPPORTED
No documentation available
constants.HTTP_STATUS_IM_USED
No documentation available
constants.HTTP_STATUS_INSUFFICIENT_STORAGE
No documentation available
constants.HTTP_STATUS_INTERNAL_SERVER_ERROR
No documentation available
constants.HTTP_STATUS_LENGTH_REQUIRED
No documentation available
constants.HTTP_STATUS_LOCKED
No documentation available
constants.HTTP_STATUS_LOOP_DETECTED
No documentation available
constants.HTTP_STATUS_METHOD_NOT_ALLOWED
No documentation available
constants.HTTP_STATUS_MISDIRECTED_REQUEST
No documentation available
constants.HTTP_STATUS_MOVED_PERMANENTLY
No documentation available
constants.HTTP_STATUS_MULTI_STATUS
No documentation available
constants.HTTP_STATUS_MULTIPLE_CHOICES
No documentation available
constants.HTTP_STATUS_NETWORK_AUTHENTICATION_REQUIRED
No documentation available
constants.HTTP_STATUS_NO_CONTENT
No documentation available
constants.HTTP_STATUS_NON_AUTHORITATIVE_INFORMATION
No documentation available
constants.HTTP_STATUS_NOT_ACCEPTABLE
No documentation available
constants.HTTP_STATUS_NOT_EXTENDED
No documentation available
constants.HTTP_STATUS_NOT_FOUND
No documentation available
constants.HTTP_STATUS_NOT_IMPLEMENTED
No documentation available
constants.HTTP_STATUS_NOT_MODIFIED
No documentation available
constants.HTTP_STATUS_OK
No documentation available
constants.HTTP_STATUS_PARTIAL_CONTENT
No documentation available
constants.HTTP_STATUS_PAYLOAD_TOO_LARGE
No documentation available
constants.HTTP_STATUS_PAYMENT_REQUIRED
No documentation available
constants.HTTP_STATUS_PERMANENT_REDIRECT
No documentation available
constants.HTTP_STATUS_PRECONDITION_FAILED
No documentation available
constants.HTTP_STATUS_PRECONDITION_REQUIRED
No documentation available
constants.HTTP_STATUS_PROCESSING
No documentation available
constants.HTTP_STATUS_PROXY_AUTHENTICATION_REQUIRED
No documentation available
constants.HTTP_STATUS_RANGE_NOT_SATISFIABLE
No documentation available
constants.HTTP_STATUS_REQUEST_HEADER_FIELDS_TOO_LARGE
No documentation available
constants.HTTP_STATUS_REQUEST_TIMEOUT
No documentation available
constants.HTTP_STATUS_RESET_CONTENT
No documentation available
constants.HTTP_STATUS_SEE_OTHER
No documentation available
constants.HTTP_STATUS_SERVICE_UNAVAILABLE
No documentation available
constants.HTTP_STATUS_SWITCHING_PROTOCOLS
No documentation available
constants.HTTP_STATUS_TEAPOT
No documentation available
constants.HTTP_STATUS_TEMPORARY_REDIRECT
No documentation available
constants.HTTP_STATUS_TOO_MANY_REQUESTS
No documentation available
constants.HTTP_STATUS_UNAUTHORIZED
No documentation available
constants.HTTP_STATUS_UNAVAILABLE_FOR_LEGAL_REASONS
No documentation available
constants.HTTP_STATUS_UNORDERED_COLLECTION
No documentation available
constants.HTTP_STATUS_UNPROCESSABLE_ENTITY
No documentation available
constants.HTTP_STATUS_UNSUPPORTED_MEDIA_TYPE
No documentation available
constants.HTTP_STATUS_UPGRADE_REQUIRED
No documentation available
constants.HTTP_STATUS_URI_TOO_LONG
No documentation available
constants.HTTP_STATUS_USE_PROXY
No documentation available
constants.HTTP_STATUS_VARIANT_ALSO_NEGOTIATES
No documentation available
constants.MAX_INITIAL_WINDOW_SIZE
No documentation available
constants.MAX_MAX_FRAME_SIZE
No documentation available
constants.MIN_MAX_FRAME_SIZE
No documentation available
constants.NGHTTP2_CANCEL
No documentation available
constants.NGHTTP2_COMPRESSION_ERROR
No documentation available
constants.NGHTTP2_CONNECT_ERROR
No documentation available
constants.NGHTTP2_DEFAULT_WEIGHT
No documentation available
constants.NGHTTP2_ENHANCE_YOUR_CALM
No documentation available
constants.NGHTTP2_ERR_FRAME_SIZE_ERROR
No documentation available
constants.NGHTTP2_FLAG_ACK
No documentation available
constants.NGHTTP2_FLAG_END_HEADERS
No documentation available
constants.NGHTTP2_FLAG_END_STREAM
No documentation available
constants.NGHTTP2_FLAG_NONE
No documentation available
constants.NGHTTP2_FLAG_PADDED
No documentation available
constants.NGHTTP2_FLAG_PRIORITY
No documentation available
constants.NGHTTP2_FLOW_CONTROL_ERROR
No documentation available
constants.NGHTTP2_FRAME_SIZE_ERROR
No documentation available
constants.NGHTTP2_HTTP_1_1_REQUIRED
No documentation available
constants.NGHTTP2_INADEQUATE_SECURITY
No documentation available
constants.NGHTTP2_INTERNAL_ERROR
No documentation available
constants.NGHTTP2_NO_ERROR
No documentation available
constants.NGHTTP2_PROTOCOL_ERROR
No documentation available
constants.NGHTTP2_REFUSED_STREAM
No documentation available
constants.NGHTTP2_SESSION_CLIENT
No documentation available
constants.NGHTTP2_SESSION_SERVER
No documentation available
constants.NGHTTP2_SETTINGS_ENABLE_PUSH
No documentation available
constants.NGHTTP2_SETTINGS_HEADER_TABLE_SIZE
No documentation available
constants.NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE
No documentation available
constants.NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS
No documentation available
constants.NGHTTP2_SETTINGS_MAX_FRAME_SIZE
No documentation available
constants.NGHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE
No documentation available
constants.NGHTTP2_SETTINGS_TIMEOUT
No documentation available
constants.NGHTTP2_STREAM_CLOSED
No documentation available
constants.NGHTTP2_STREAM_STATE_CLOSED
No documentation available
constants.NGHTTP2_STREAM_STATE_HALF_CLOSED_LOCAL
No documentation available
constants.NGHTTP2_STREAM_STATE_HALF_CLOSED_REMOTE
No documentation available
constants.NGHTTP2_STREAM_STATE_IDLE
No documentation available
constants.NGHTTP2_STREAM_STATE_OPEN
No documentation available
constants.NGHTTP2_STREAM_STATE_RESERVED_LOCAL
No documentation available
constants.NGHTTP2_STREAM_STATE_RESERVED_REMOTE
No documentation available
constants.PADDING_STRATEGY_CALLBACK
No documentation available
constants.PADDING_STRATEGY_MAX
No documentation available
constants.PADDING_STRATEGY_NONE
No documentation available

variable constants.DEFAULT_SETTINGS_ENABLE_PUSH

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.DEFAULT_SETTINGS_HEADER_TABLE_SIZE

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.DEFAULT_SETTINGS_INITIAL_WINDOW_SIZE

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.DEFAULT_SETTINGS_MAX_FRAME_SIZE

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.HTTP2_HEADER_ACCEPT

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_HEADER_ACCEPT_CHARSET

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_HEADER_ACCEPT_ENCODING

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_HEADER_ACCEPT_LANGUAGE

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_HEADER_ACCEPT_RANGES

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_HEADER_ACCESS_CONTROL_ALLOW_CREDENTIALS

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_HEADER_ACCESS_CONTROL_ALLOW_HEADERS

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_HEADER_ACCESS_CONTROL_ALLOW_METHODS

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_HEADER_ACCESS_CONTROL_ALLOW_ORIGIN

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_HEADER_ACCESS_CONTROL_EXPOSE_HEADERS

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_HEADER_ACCESS_CONTROL_REQUEST_HEADERS

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_HEADER_ACCESS_CONTROL_REQUEST_METHOD

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_HEADER_AGE

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_HEADER_ALLOW

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_HEADER_AUTHORITY

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_HEADER_AUTHORIZATION

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_HEADER_CACHE_CONTROL

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_HEADER_CONNECTION

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_HEADER_CONTENT_DISPOSITION

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_HEADER_CONTENT_ENCODING

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_HEADER_CONTENT_LANGUAGE

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_HEADER_CONTENT_LENGTH

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_HEADER_CONTENT_LOCATION

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_HEADER_CONTENT_MD5

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_HEADER_CONTENT_RANGE

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_HEADER_CONTENT_TYPE

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_HEADER_COOKIE

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_HEADER_DATE

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_HEADER_ETAG

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_HEADER_EXPECT

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_HEADER_EXPIRES

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_HEADER_FROM

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_HEADER_HOST

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_HEADER_HTTP2_SETTINGS

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_HEADER_IF_MATCH

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_HEADER_IF_MODIFIED_SINCE

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_HEADER_IF_NONE_MATCH

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_HEADER_IF_RANGE

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_HEADER_IF_UNMODIFIED_SINCE

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_HEADER_KEEP_ALIVE

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_HEADER_LAST_MODIFIED

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_HEADER_LINK

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_HEADER_LOCATION

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_HEADER_MAX_FORWARDS

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_HEADER_METHOD

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_HEADER_PATH

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_HEADER_PREFER

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_HEADER_PROXY_AUTHENTICATE

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_HEADER_PROXY_AUTHORIZATION

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_HEADER_PROXY_CONNECTION

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_HEADER_RANGE

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_HEADER_REFERER

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_HEADER_REFRESH

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_HEADER_RETRY_AFTER

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_HEADER_SCHEME

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_HEADER_SERVER

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_HEADER_SET_COOKIE

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_HEADER_STATUS

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_HEADER_STRICT_TRANSPORT_SECURITY

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_HEADER_TE

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_HEADER_TRANSFER_ENCODING

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_HEADER_UPGRADE

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_HEADER_USER_AGENT

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_HEADER_VARY

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_HEADER_VIA

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_HEADER_WWW_AUTHENTICATE

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_METHOD_ACL

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_METHOD_BASELINE_CONTROL

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_METHOD_BIND

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_METHOD_CHECKIN

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_METHOD_CHECKOUT

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_METHOD_CONNECT

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_METHOD_COPY

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_METHOD_DELETE

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_METHOD_GET

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_METHOD_HEAD

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_METHOD_LABEL

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_METHOD_LINK

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_METHOD_LOCK

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_METHOD_MERGE

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_METHOD_MKACTIVITY

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_METHOD_MKCALENDAR

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_METHOD_MKCOL

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_METHOD_MKREDIRECTREF

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_METHOD_MKWORKSPACE

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_METHOD_MOVE

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_METHOD_OPTIONS

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_METHOD_ORDERPATCH

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_METHOD_PATCH

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_METHOD_POST

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_METHOD_PRI

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_METHOD_PROPFIND

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_METHOD_PROPPATCH

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_METHOD_PUT

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_METHOD_REBIND

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_METHOD_REPORT

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_METHOD_SEARCH

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_METHOD_TRACE

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_METHOD_UNBIND

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_METHOD_UNCHECKOUT

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_METHOD_UNLINK

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_METHOD_UNLOCK

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_METHOD_UPDATE

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_METHOD_UPDATEREDIRECTREF

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP2_METHOD_VERSION_CONTROL

Usage in Deno

import { constants } from "node:http2";

Type

string

variable constants.HTTP_STATUS_ACCEPTED

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.HTTP_STATUS_ALREADY_REPORTED

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.HTTP_STATUS_BAD_GATEWAY

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.HTTP_STATUS_BAD_REQUEST

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.HTTP_STATUS_BANDWIDTH_LIMIT_EXCEEDED

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.HTTP_STATUS_CONFLICT

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.HTTP_STATUS_CONTINUE

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.HTTP_STATUS_CREATED

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.HTTP_STATUS_EXPECTATION_FAILED

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.HTTP_STATUS_FAILED_DEPENDENCY

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.HTTP_STATUS_FORBIDDEN

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.HTTP_STATUS_FOUND

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.HTTP_STATUS_GATEWAY_TIMEOUT

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.HTTP_STATUS_GONE

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.HTTP_STATUS_HTTP_VERSION_NOT_SUPPORTED

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.HTTP_STATUS_IM_USED

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.HTTP_STATUS_INSUFFICIENT_STORAGE

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.HTTP_STATUS_INTERNAL_SERVER_ERROR

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.HTTP_STATUS_LENGTH_REQUIRED

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.HTTP_STATUS_LOCKED

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.HTTP_STATUS_LOOP_DETECTED

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.HTTP_STATUS_METHOD_NOT_ALLOWED

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.HTTP_STATUS_MISDIRECTED_REQUEST

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.HTTP_STATUS_MOVED_PERMANENTLY

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.HTTP_STATUS_MULTI_STATUS

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.HTTP_STATUS_MULTIPLE_CHOICES

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.HTTP_STATUS_NETWORK_AUTHENTICATION_REQUIRED

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.HTTP_STATUS_NO_CONTENT

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.HTTP_STATUS_NON_AUTHORITATIVE_INFORMATION

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.HTTP_STATUS_NOT_ACCEPTABLE

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.HTTP_STATUS_NOT_EXTENDED

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.HTTP_STATUS_NOT_FOUND

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.HTTP_STATUS_NOT_IMPLEMENTED

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.HTTP_STATUS_NOT_MODIFIED

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.HTTP_STATUS_OK

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.HTTP_STATUS_PARTIAL_CONTENT

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.HTTP_STATUS_PAYLOAD_TOO_LARGE

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.HTTP_STATUS_PAYMENT_REQUIRED

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.HTTP_STATUS_PERMANENT_REDIRECT

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.HTTP_STATUS_PRECONDITION_FAILED

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.HTTP_STATUS_PRECONDITION_REQUIRED

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.HTTP_STATUS_PROCESSING

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.HTTP_STATUS_PROXY_AUTHENTICATION_REQUIRED

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.HTTP_STATUS_RANGE_NOT_SATISFIABLE

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.HTTP_STATUS_REQUEST_HEADER_FIELDS_TOO_LARGE

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.HTTP_STATUS_REQUEST_TIMEOUT

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.HTTP_STATUS_RESET_CONTENT

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.HTTP_STATUS_SEE_OTHER

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.HTTP_STATUS_SERVICE_UNAVAILABLE

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.HTTP_STATUS_SWITCHING_PROTOCOLS

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.HTTP_STATUS_TEAPOT

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.HTTP_STATUS_TEMPORARY_REDIRECT

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.HTTP_STATUS_TOO_MANY_REQUESTS

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.HTTP_STATUS_UNAUTHORIZED

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.HTTP_STATUS_UNAVAILABLE_FOR_LEGAL_REASONS

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.HTTP_STATUS_UNORDERED_COLLECTION

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.HTTP_STATUS_UNPROCESSABLE_ENTITY

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.HTTP_STATUS_UNSUPPORTED_MEDIA_TYPE

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.HTTP_STATUS_UPGRADE_REQUIRED

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.HTTP_STATUS_URI_TOO_LONG

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.HTTP_STATUS_USE_PROXY

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.HTTP_STATUS_VARIANT_ALSO_NEGOTIATES

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.MAX_INITIAL_WINDOW_SIZE

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.MAX_MAX_FRAME_SIZE

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.MIN_MAX_FRAME_SIZE

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.NGHTTP2_CANCEL

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.NGHTTP2_COMPRESSION_ERROR

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.NGHTTP2_CONNECT_ERROR

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.NGHTTP2_DEFAULT_WEIGHT

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.NGHTTP2_ENHANCE_YOUR_CALM

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.NGHTTP2_ERR_FRAME_SIZE_ERROR

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.NGHTTP2_FLAG_ACK

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.NGHTTP2_FLAG_END_HEADERS

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.NGHTTP2_FLAG_END_STREAM

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.NGHTTP2_FLAG_NONE

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.NGHTTP2_FLAG_PADDED

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.NGHTTP2_FLAG_PRIORITY

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.NGHTTP2_FLOW_CONTROL_ERROR

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.NGHTTP2_FRAME_SIZE_ERROR

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.NGHTTP2_HTTP_1_1_REQUIRED

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.NGHTTP2_INADEQUATE_SECURITY

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.NGHTTP2_INTERNAL_ERROR

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.NGHTTP2_NO_ERROR

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.NGHTTP2_PROTOCOL_ERROR

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.NGHTTP2_REFUSED_STREAM

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.NGHTTP2_SESSION_CLIENT

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.NGHTTP2_SESSION_SERVER

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.NGHTTP2_SETTINGS_ENABLE_PUSH

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.NGHTTP2_SETTINGS_HEADER_TABLE_SIZE

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.NGHTTP2_SETTINGS_MAX_FRAME_SIZE

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.NGHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.NGHTTP2_SETTINGS_TIMEOUT

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.NGHTTP2_STREAM_CLOSED

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.NGHTTP2_STREAM_STATE_CLOSED

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.NGHTTP2_STREAM_STATE_HALF_CLOSED_LOCAL

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.NGHTTP2_STREAM_STATE_HALF_CLOSED_REMOTE

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.NGHTTP2_STREAM_STATE_IDLE

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.NGHTTP2_STREAM_STATE_OPEN

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.NGHTTP2_STREAM_STATE_RESERVED_LOCAL

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.NGHTTP2_STREAM_STATE_RESERVED_REMOTE

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.PADDING_STRATEGY_CALLBACK

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.PADDING_STRATEGY_MAX

Usage in Deno

import { constants } from "node:http2";

Type

number

variable constants.PADDING_STRATEGY_NONE

Usage in Deno

import { constants } from "node:http2";

Type

number

variable sensitiveHeaders

Usage in Deno

import { sensitiveHeaders } from "node:http2";

This symbol can be set as a property on the HTTP/2 headers object with an array value in order to provide a list of headers considered sensitive.

Type

symbol

© 2018–2025 the Deno authors
Licensed under the MIT License.
https://docs.deno.com/api/node/http2

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API