Skip to main content
OutgoingMessage.prototype.flushHeaders - http - Node documentation
method OutgoingMessage.prototype.flushHeaders

Usage in Deno

import { OutgoingMessage } from "node:http";
OutgoingMessage.prototype.flushHeaders(): void

Flushes the message headers.

For efficiency reason, Node.js normally buffers the message headers until outgoingMessage.end() is called or the first chunk of message data is written. It then tries to pack the headers and data into a single TCP packet.

It is usually desired (it saves a TCP round-trip), but not when the first data is not sent until possibly much later. outgoingMessage.flushHeaders() bypasses the optimization and kickstarts the message.

Return Type

void
Back to top