{
  "type": "module",
  "source": "doc/api/http.md",
  "modules": [
    {
      "textRaw": "HTTP",
      "name": "http",
      "introduced_in": "v0.10.0",
      "type": "module",
      "stability": 2,
      "stabilityText": "Stable",
      "desc": "<p>This module, containing both a client and server, can be imported via\n<code>require('node:http')</code> (CommonJS) or <code>import * as http from 'node:http'</code> (ES module).</p>\n<p>The HTTP interfaces in Node.js are designed to support many features\nof the protocol which have been traditionally difficult to use.\nIn particular, large, possibly chunk-encoded, messages. The interface is\ncareful to never buffer entire requests or responses, so the\nuser is able to stream data.</p>\n<p>HTTP message headers are represented by an object like this:</p>\n<pre><code class=\"language-json\">{ \"content-length\": \"123\",\n  \"content-type\": \"text/plain\",\n  \"connection\": \"keep-alive\",\n  \"host\": \"example.com\",\n  \"accept\": \"*/*\" }\n</code></pre>\n<p>Keys are lowercased. Values are not modified.</p>\n<p>In order to support the full spectrum of possible HTTP applications, the Node.js\nHTTP API is very low-level. It deals with stream handling and message\nparsing only. It parses a message into headers and body but it does not\nparse the actual headers or the body.</p>\n<p>See <a href=\"#messageheaders\"><code>message.headers</code></a> for details on how duplicate headers are handled.</p>\n<p>The raw headers as they were received are retained in the <code>rawHeaders</code>\nproperty, which is an array of <code>[key, value, key2, value2, ...]</code>. For\nexample, the previous message header object might have a <code>rawHeaders</code>\nlist like the following:</p>\n<pre><code class=\"language-json\">[ \"ConTent-Length\", \"123456\",\n  \"content-LENGTH\", \"123\",\n  \"content-type\", \"text/plain\",\n  \"CONNECTION\", \"keep-alive\",\n  \"Host\", \"example.com\",\n  \"accepT\", \"*/*\" ]\n</code></pre>",
      "classes": [
        {
          "textRaw": "Class: `http.Agent`",
          "name": "http.Agent",
          "type": "class",
          "meta": {
            "added": [
              "v0.3.4"
            ],
            "changes": []
          },
          "desc": "<p>An <code>Agent</code> is responsible for managing connection persistence\nand reuse for HTTP clients. It maintains a queue of pending requests\nfor a given host and port, reusing a single socket connection for each\nuntil the queue is empty, at which time the socket is either destroyed\nor put into a pool where it is kept to be used again for requests to the\nsame host and port. Whether it is destroyed or pooled depends on the\n<code>keepAlive</code> <a href=\"#new-agentoptions\">option</a>.</p>\n<p>Pooled connections have TCP Keep-Alive enabled for them, but servers may\nstill close idle connections, in which case they will be removed from the\npool and a new connection will be made when a new HTTP request is made for\nthat host and port. Servers may also refuse to allow multiple requests\nover the same connection, in which case the connection will have to be\nremade for every request and cannot be pooled. The <code>Agent</code> will still make\nthe requests to that server, but each one will occur over a new connection.</p>\n<p>When a connection is closed by the client or the server, it is removed\nfrom the pool. Any unused sockets in the pool will be unrefed so as not\nto keep the Node.js process running when there are no outstanding requests.\n(see <a href=\"net.html#socketunref\"><code>socket.unref()</code></a>).</p>\n<p>It is good practice, to <a href=\"#agentdestroy\"><code>destroy()</code></a> an <code>Agent</code> instance when it is no\nlonger in use, because unused sockets consume OS resources.</p>\n<p>Sockets are removed from an agent when the socket emits either\na <code>'close'</code> event or an <code>'agentRemove'</code> event. When intending to keep one\nHTTP request open for a long time without keeping it in the agent, something\nlike the following may be done:</p>\n<pre><code class=\"language-js\">http.get(options, (res) => {\n  // Do stuff\n}).on('socket', (socket) => {\n  socket.emit('agentRemove');\n});\n</code></pre>\n<p>An agent may also be used for an individual request. By providing\n<code>{agent: false}</code> as an option to the <code>http.get()</code> or <code>http.request()</code>\nfunctions, a one-time use <code>Agent</code> with default options will be used\nfor the client connection.</p>\n<p><code>agent:false</code>:</p>\n<pre><code class=\"language-js\">http.get({\n  hostname: 'localhost',\n  port: 80,\n  path: '/',\n  agent: false,  // Create a new agent just for this one request\n}, (res) => {\n  // Do stuff with response\n});\n</code></pre>",
          "signatures": [
            {
              "textRaw": "`new Agent([options])`",
              "name": "Agent",
              "type": "ctor",
              "meta": {
                "added": [
                  "v0.3.4"
                ],
                "changes": [
                  {
                    "version": [
                      "v24.7.0",
                      "v22.20.0"
                    ],
                    "pr-url": "https://github.com/nodejs/node/pull/59315",
                    "description": "Add support for `agentKeepAliveTimeoutBuffer`."
                  },
                  {
                    "version": [
                      "v24.5.0",
                      "v22.21.0"
                    ],
                    "pr-url": "https://github.com/nodejs/node/pull/58980",
                    "description": "Add support for `proxyEnv`."
                  },
                  {
                    "version": [
                      "v24.5.0",
                      "v22.21.0"
                    ],
                    "pr-url": "https://github.com/nodejs/node/pull/58980",
                    "description": "Add support for `defaultPort` and `protocol`."
                  },
                  {
                    "version": [
                      "v15.6.0",
                      "v14.17.0"
                    ],
                    "pr-url": "https://github.com/nodejs/node/pull/36685",
                    "description": "Change the default scheduling from 'fifo' to 'lifo'."
                  },
                  {
                    "version": [
                      "v14.5.0",
                      "v12.19.0"
                    ],
                    "pr-url": "https://github.com/nodejs/node/pull/33617",
                    "description": "Add `maxTotalSockets` option to agent constructor."
                  },
                  {
                    "version": [
                      "v14.5.0",
                      "v12.20.0"
                    ],
                    "pr-url": "https://github.com/nodejs/node/pull/33278",
                    "description": "Add `scheduling` option to specify the free socket scheduling strategy."
                  }
                ]
              },
              "params": [
                {
                  "textRaw": "`options` {Object} Set of configurable options to set on the agent. Can have the following fields:",
                  "name": "options",
                  "type": "Object",
                  "desc": "Set of configurable options to set on the agent. Can have the following fields:",
                  "options": [
                    {
                      "textRaw": "`keepAlive` {boolean} Keep sockets around even when there are no outstanding requests, so they can be used for future requests without having to reestablish a TCP connection. Not to be confused with the `keep-alive` value of the `Connection` header. The `Connection: keep-alive` header is always sent when using an agent except when the `Connection` header is explicitly specified or when the `keepAlive` and `maxSockets` options are respectively set to `false` and `Infinity`, in which case `Connection: close` will be used. **Default:** `false`.",
                      "name": "keepAlive",
                      "type": "boolean",
                      "default": "`false`",
                      "desc": "Keep sockets around even when there are no outstanding requests, so they can be used for future requests without having to reestablish a TCP connection. Not to be confused with the `keep-alive` value of the `Connection` header. The `Connection: keep-alive` header is always sent when using an agent except when the `Connection` header is explicitly specified or when the `keepAlive` and `maxSockets` options are respectively set to `false` and `Infinity`, in which case `Connection: close` will be used."
                    },
                    {
                      "textRaw": "`keepAliveMsecs` {number} When using the `keepAlive` option, specifies the initial delay for TCP Keep-Alive packets. Ignored when the `keepAlive` option is `false` or `undefined`. **Default:** `1000`.",
                      "name": "keepAliveMsecs",
                      "type": "number",
                      "default": "`1000`",
                      "desc": "When using the `keepAlive` option, specifies the initial delay for TCP Keep-Alive packets. Ignored when the `keepAlive` option is `false` or `undefined`."
                    },
                    {
                      "textRaw": "`agentKeepAliveTimeoutBuffer` {number} Milliseconds to subtract from the server-provided `keep-alive: timeout=...` hint when determining socket expiration time. This buffer helps ensure the agent closes the socket slightly before the server does, reducing the chance of sending a request on a socket that’s about to be closed by the server. **Default:** `1000`.",
                      "name": "agentKeepAliveTimeoutBuffer",
                      "type": "number",
                      "default": "`1000`",
                      "desc": "Milliseconds to subtract from the server-provided `keep-alive: timeout=...` hint when determining socket expiration time. This buffer helps ensure the agent closes the socket slightly before the server does, reducing the chance of sending a request on a socket that’s about to be closed by the server."
                    },
                    {
                      "textRaw": "`maxSockets` {number} Maximum number of sockets to allow per host. If the same host opens multiple concurrent connections, each request will use new socket until the `maxSockets` value is reached. If the host attempts to open more connections than `maxSockets`, the additional requests will enter into a pending request queue, and will enter active connection state when an existing connection terminates. This makes sure there are at most `maxSockets` active connections at any point in time, from a given host. **Default:** `Infinity`.",
                      "name": "maxSockets",
                      "type": "number",
                      "default": "`Infinity`",
                      "desc": "Maximum number of sockets to allow per host. If the same host opens multiple concurrent connections, each request will use new socket until the `maxSockets` value is reached. If the host attempts to open more connections than `maxSockets`, the additional requests will enter into a pending request queue, and will enter active connection state when an existing connection terminates. This makes sure there are at most `maxSockets` active connections at any point in time, from a given host."
                    },
                    {
                      "textRaw": "`maxTotalSockets` {number} Maximum number of sockets allowed for all hosts in total. Each request will use a new socket until the maximum is reached. **Default:** `Infinity`.",
                      "name": "maxTotalSockets",
                      "type": "number",
                      "default": "`Infinity`",
                      "desc": "Maximum number of sockets allowed for all hosts in total. Each request will use a new socket until the maximum is reached."
                    },
                    {
                      "textRaw": "`maxFreeSockets` {number} Maximum number of sockets per host to leave open in a free state. Only relevant if `keepAlive` is set to `true`. **Default:** `256`.",
                      "name": "maxFreeSockets",
                      "type": "number",
                      "default": "`256`",
                      "desc": "Maximum number of sockets per host to leave open in a free state. Only relevant if `keepAlive` is set to `true`."
                    },
                    {
                      "textRaw": "`scheduling` {string} Scheduling strategy to apply when picking the next free socket to use. It can be `'fifo'` or `'lifo'`. The main difference between the two scheduling strategies is that `'lifo'` selects the most recently used socket, while `'fifo'` selects the least recently used socket. In case of a low rate of request per second, the `'lifo'` scheduling will lower the risk of picking a socket that might have been closed by the server due to inactivity. In case of a high rate of request per second, the `'fifo'` scheduling will maximize the number of open sockets, while the `'lifo'` scheduling will keep it as low as possible. **Default:** `'lifo'`.",
                      "name": "scheduling",
                      "type": "string",
                      "default": "`'lifo'`",
                      "desc": "Scheduling strategy to apply when picking the next free socket to use. It can be `'fifo'` or `'lifo'`. The main difference between the two scheduling strategies is that `'lifo'` selects the most recently used socket, while `'fifo'` selects the least recently used socket. In case of a low rate of request per second, the `'lifo'` scheduling will lower the risk of picking a socket that might have been closed by the server due to inactivity. In case of a high rate of request per second, the `'fifo'` scheduling will maximize the number of open sockets, while the `'lifo'` scheduling will keep it as low as possible."
                    },
                    {
                      "textRaw": "`timeout` {number} Socket timeout in milliseconds. This will set the timeout when the socket is created.",
                      "name": "timeout",
                      "type": "number",
                      "desc": "Socket timeout in milliseconds. This will set the timeout when the socket is created."
                    },
                    {
                      "textRaw": "`proxyEnv` {Object|undefined} Environment variables for proxy configuration. See Built-in Proxy Support for details. **Default:** `undefined`",
                      "name": "proxyEnv",
                      "type": "Object|undefined",
                      "default": "`undefined`",
                      "desc": "Environment variables for proxy configuration. See Built-in Proxy Support for details.",
                      "options": [
                        {
                          "textRaw": "`HTTP_PROXY` {string|undefined} URL for the proxy server that HTTP requests should use. If undefined, no proxy is used for HTTP requests.",
                          "name": "HTTP_PROXY",
                          "type": "string|undefined",
                          "desc": "URL for the proxy server that HTTP requests should use. If undefined, no proxy is used for HTTP requests."
                        },
                        {
                          "textRaw": "`HTTPS_PROXY` {string|undefined} URL for the proxy server that HTTPS requests should use. If undefined, no proxy is used for HTTPS requests.",
                          "name": "HTTPS_PROXY",
                          "type": "string|undefined",
                          "desc": "URL for the proxy server that HTTPS requests should use. If undefined, no proxy is used for HTTPS requests."
                        },
                        {
                          "textRaw": "`NO_PROXY` {string|undefined} Patterns specifying the endpoints that should not be routed through a proxy.",
                          "name": "NO_PROXY",
                          "type": "string|undefined",
                          "desc": "Patterns specifying the endpoints that should not be routed through a proxy."
                        },
                        {
                          "textRaw": "`http_proxy` {string|undefined} Same as `HTTP_PROXY`. If both are set, `http_proxy` takes precedence.",
                          "name": "http_proxy",
                          "type": "string|undefined",
                          "desc": "Same as `HTTP_PROXY`. If both are set, `http_proxy` takes precedence."
                        },
                        {
                          "textRaw": "`https_proxy` {string|undefined} Same as `HTTPS_PROXY`. If both are set, `https_proxy` takes precedence.",
                          "name": "https_proxy",
                          "type": "string|undefined",
                          "desc": "Same as `HTTPS_PROXY`. If both are set, `https_proxy` takes precedence."
                        },
                        {
                          "textRaw": "`no_proxy` {string|undefined} Same as `NO_PROXY`. If both are set, `no_proxy` takes precedence.",
                          "name": "no_proxy",
                          "type": "string|undefined",
                          "desc": "Same as `NO_PROXY`. If both are set, `no_proxy` takes precedence."
                        }
                      ]
                    },
                    {
                      "textRaw": "`defaultPort` {number} Default port to use when the port is not specified in requests. **Default:** `80`.",
                      "name": "defaultPort",
                      "type": "number",
                      "default": "`80`",
                      "desc": "Default port to use when the port is not specified in requests."
                    },
                    {
                      "textRaw": "`protocol` {string} The protocol to use for the agent. **Default:** `'http:'`.",
                      "name": "protocol",
                      "type": "string",
                      "default": "`'http:'`",
                      "desc": "The protocol to use for the agent."
                    }
                  ],
                  "optional": true
                }
              ],
              "desc": "<p><code>options</code> in <a href=\"net.html#socketconnectoptions-connectlistener\"><code>socket.connect()</code></a> are also supported.</p>\n<p>To configure any of them, a custom <a href=\"#class-httpagent\"><code>http.Agent</code></a> instance must be created.</p>\n<pre><code class=\"language-mjs\">import { Agent, request } from 'node:http';\nconst keepAliveAgent = new Agent({ keepAlive: true });\noptions.agent = keepAliveAgent;\nrequest(options, onResponseCallback);\n</code></pre>\n<pre><code class=\"language-cjs\">const http = require('node:http');\nconst keepAliveAgent = new http.Agent({ keepAlive: true });\noptions.agent = keepAliveAgent;\nhttp.request(options, onResponseCallback);\n</code></pre>"
            }
          ],
          "methods": [
            {
              "textRaw": "`agent.createConnection(options[, callback])`",
              "name": "createConnection",
              "type": "method",
              "meta": {
                "added": [
                  "v0.11.4"
                ],
                "changes": []
              },
              "signatures": [
                {
                  "params": [
                    {
                      "textRaw": "`options` {Object} Options containing connection details. Check `net.createConnection()` for the format of the options. For custom agents, this object is passed to the custom `createConnection` function.",
                      "name": "options",
                      "type": "Object",
                      "desc": "Options containing connection details. Check `net.createConnection()` for the format of the options. For custom agents, this object is passed to the custom `createConnection` function."
                    },
                    {
                      "textRaw": "`callback` {Function} (Optional, primarily for custom agents) A function to be called by a custom `createConnection` implementation when the socket is created, especially for asynchronous operations.",
                      "name": "callback",
                      "type": "Function",
                      "desc": "(Optional, primarily for custom agents) A function to be called by a custom `createConnection` implementation when the socket is created, especially for asynchronous operations.",
                      "options": [
                        {
                          "textRaw": "`err` {Error|null} An error object if socket creation failed.",
                          "name": "err",
                          "type": "Error|null",
                          "desc": "An error object if socket creation failed."
                        },
                        {
                          "textRaw": "`socket` {stream.Duplex} The created socket.",
                          "name": "socket",
                          "type": "stream.Duplex",
                          "desc": "The created socket."
                        }
                      ],
                      "optional": true
                    }
                  ],
                  "return": {
                    "textRaw": "Returns: {stream.Duplex} The created socket. This is returned by the default implementation or by a custom synchronous `createConnection` implementation. If a custom `createConnection` uses the `callback` for asynchronous operation, this return value might not be the primary way to obtain the socket.",
                    "name": "return",
                    "type": "stream.Duplex",
                    "desc": "The created socket. This is returned by the default implementation or by a custom synchronous `createConnection` implementation. If a custom `createConnection` uses the `callback` for asynchronous operation, this return value might not be the primary way to obtain the socket."
                  }
                }
              ],
              "desc": "<p>Produces a socket/stream to be used for HTTP requests.</p>\n<p>By default, this function behaves identically to <a href=\"net.html#netcreateconnectionoptions-connectlistener\"><code>net.createConnection()</code></a>,\nsynchronously returning the created socket. The optional <code>callback</code> parameter in the\nsignature is <strong>not</strong> used by this default implementation.</p>\n<p>However, custom agents may override this method to provide greater flexibility,\nfor example, to create sockets asynchronously. When overriding <code>createConnection</code>:</p>\n<ol>\n<li><strong>Synchronous socket creation</strong>: The overriding method can return the\nsocket/stream directly.</li>\n<li><strong>Asynchronous socket creation</strong>: The overriding method can accept the <code>callback</code>\nand pass the created socket/stream to it (e.g., <code>callback(null, newSocket)</code>).\nIf an error occurs during socket creation, it should be passed as the first\nargument to the <code>callback</code> (e.g., <code>callback(err)</code>).</li>\n</ol>\n<p>The agent will call the provided <code>createConnection</code> function with <code>options</code> and\nthis internal <code>callback</code>. The <code>callback</code> provided by the agent has a signature\nof <code>(err, stream)</code>.</p>"
            },
            {
              "textRaw": "`agent.keepSocketAlive(socket)`",
              "name": "keepSocketAlive",
              "type": "method",
              "meta": {
                "added": [
                  "v8.1.0"
                ],
                "changes": []
              },
              "signatures": [
                {
                  "params": [
                    {
                      "textRaw": "`socket` {stream.Duplex}",
                      "name": "socket",
                      "type": "stream.Duplex"
                    }
                  ]
                }
              ],
              "desc": "<p>Called when <code>socket</code> is detached from a request and could be persisted by the\n<code>Agent</code>. Default behavior is to:</p>\n<pre><code class=\"language-js\">socket.setKeepAlive(true, this.keepAliveMsecs);\nsocket.unref();\nreturn true;\n</code></pre>\n<p>This method can be overridden by a particular <code>Agent</code> subclass. If this\nmethod returns a falsy value, the socket will be destroyed instead of persisting\nit for use with the next request.</p>\n<p>The <code>socket</code> argument can be an instance of <a href=\"net.html#class-netsocket\"><code>&#x3C;net.Socket></code></a>, a subclass of\n<a href=\"stream.html#class-streamduplex\"><code>&#x3C;stream.Duplex></code></a>.</p>"
            },
            {
              "textRaw": "`agent.reuseSocket(socket, request)`",
              "name": "reuseSocket",
              "type": "method",
              "meta": {
                "added": [
                  "v8.1.0"
                ],
                "changes": []
              },
              "signatures": [
                {
                  "params": [
                    {
                      "textRaw": "`socket` {stream.Duplex}",
                      "name": "socket",
                      "type": "stream.Duplex"
                    },
                    {
                      "textRaw": "`request` {http.ClientRequest}",
                      "name": "request",
                      "type": "http.ClientRequest"
                    }
                  ]
                }
              ],
              "desc": "<p>Called when <code>socket</code> is attached to <code>request</code> after being persisted because of\nthe keep-alive options. Default behavior is to:</p>\n<pre><code class=\"language-js\">socket.ref();\n</code></pre>\n<p>This method can be overridden by a particular <code>Agent</code> subclass.</p>\n<p>The <code>socket</code> argument can be an instance of <a href=\"net.html#class-netsocket\"><code>&#x3C;net.Socket></code></a>, a subclass of\n<a href=\"stream.html#class-streamduplex\"><code>&#x3C;stream.Duplex></code></a>.</p>"
            },
            {
              "textRaw": "`agent.destroy()`",
              "name": "destroy",
              "type": "method",
              "meta": {
                "added": [
                  "v0.11.4"
                ],
                "changes": []
              },
              "signatures": [
                {
                  "params": []
                }
              ],
              "desc": "<p>Destroy any sockets that are currently in use by the agent.</p>\n<p>It is usually not necessary to do this. However, if using an\nagent with <code>keepAlive</code> enabled, then it is best to explicitly shut down\nthe agent when it is no longer needed. Otherwise,\nsockets might stay open for quite a long time before the server\nterminates them.</p>"
            },
            {
              "textRaw": "`agent.getName([options])`",
              "name": "getName",
              "type": "method",
              "meta": {
                "added": [
                  "v0.11.4"
                ],
                "changes": [
                  {
                    "version": [
                      "v17.7.0",
                      "v16.15.0"
                    ],
                    "pr-url": "https://github.com/nodejs/node/pull/41906",
                    "description": "The `options` parameter is now optional."
                  }
                ]
              },
              "signatures": [
                {
                  "params": [
                    {
                      "textRaw": "`options` {Object} A set of options providing information for name generation",
                      "name": "options",
                      "type": "Object",
                      "desc": "A set of options providing information for name generation",
                      "options": [
                        {
                          "textRaw": "`host` {string} A domain name or IP address of the server to issue the request to",
                          "name": "host",
                          "type": "string",
                          "desc": "A domain name or IP address of the server to issue the request to"
                        },
                        {
                          "textRaw": "`port` {number} Port of remote server",
                          "name": "port",
                          "type": "number",
                          "desc": "Port of remote server"
                        },
                        {
                          "textRaw": "`localAddress` {string} Local interface to bind for network connections when issuing the request",
                          "name": "localAddress",
                          "type": "string",
                          "desc": "Local interface to bind for network connections when issuing the request"
                        },
                        {
                          "textRaw": "`family` {integer} Must be 4 or 6 if this doesn't equal `undefined`.",
                          "name": "family",
                          "type": "integer",
                          "desc": "Must be 4 or 6 if this doesn't equal `undefined`."
                        }
                      ],
                      "optional": true
                    }
                  ],
                  "return": {
                    "textRaw": "Returns: {string}",
                    "name": "return",
                    "type": "string"
                  }
                }
              ],
              "desc": "<p>Get a unique name for a set of request options, to determine whether a\nconnection can be reused. For an HTTP agent, this returns\n<code>host:port:localAddress</code> or <code>host:port:localAddress:family</code>. For an HTTPS agent,\nthe name includes the CA, cert, ciphers, and other HTTPS/TLS-specific options\nthat determine socket reusability.</p>"
            }
          ],
          "properties": [
            {
              "textRaw": "Type: {Object}",
              "name": "freeSockets",
              "type": "Object",
              "meta": {
                "added": [
                  "v0.11.4"
                ],
                "changes": [
                  {
                    "version": "v16.0.0",
                    "pr-url": "https://github.com/nodejs/node/pull/36409",
                    "description": "The property now has a `null` prototype."
                  }
                ]
              },
              "desc": "<p>An object which contains arrays of sockets currently awaiting use by\nthe agent when <code>keepAlive</code> is enabled. Do not modify.</p>\n<p>Sockets in the <code>freeSockets</code> list will be automatically destroyed and\nremoved from the array on <code>'timeout'</code>.</p>"
            },
            {
              "textRaw": "Type: {number}",
              "name": "maxFreeSockets",
              "type": "number",
              "meta": {
                "added": [
                  "v0.11.7"
                ],
                "changes": []
              },
              "desc": "<p>By default set to 256. For agents with <code>keepAlive</code> enabled, this\nsets the maximum number of sockets that will be left open in the free\nstate.</p>"
            },
            {
              "textRaw": "Type: {number}",
              "name": "maxSockets",
              "type": "number",
              "meta": {
                "added": [
                  "v0.3.6"
                ],
                "changes": []
              },
              "desc": "<p>By default set to <code>Infinity</code>. Determines how many concurrent sockets the agent\ncan have open per origin. Origin is the returned value of <a href=\"#agentgetnameoptions\"><code>agent.getName()</code></a>.</p>"
            },
            {
              "textRaw": "Type: {number}",
              "name": "maxTotalSockets",
              "type": "number",
              "meta": {
                "added": [
                  "v14.5.0",
                  "v12.19.0"
                ],
                "changes": []
              },
              "desc": "<p>By default set to <code>Infinity</code>. Determines how many concurrent sockets the agent\ncan have open. Unlike <code>maxSockets</code>, this parameter applies across all origins.</p>"
            },
            {
              "textRaw": "Type: {Object}",
              "name": "requests",
              "type": "Object",
              "meta": {
                "added": [
                  "v0.5.9"
                ],
                "changes": [
                  {
                    "version": "v16.0.0",
                    "pr-url": "https://github.com/nodejs/node/pull/36409",
                    "description": "The property now has a `null` prototype."
                  }
                ]
              },
              "desc": "<p>An object which contains queues of requests that have not yet been assigned to\nsockets. Do not modify.</p>"
            },
            {
              "textRaw": "Type: {Object}",
              "name": "sockets",
              "type": "Object",
              "meta": {
                "added": [
                  "v0.3.6"
                ],
                "changes": [
                  {
                    "version": "v16.0.0",
                    "pr-url": "https://github.com/nodejs/node/pull/36409",
                    "description": "The property now has a `null` prototype."
                  }
                ]
              },
              "desc": "<p>An object which contains arrays of sockets currently in use by the\nagent. Do not modify.</p>"
            }
          ]
        },
        {
          "textRaw": "Class: `http.ClientRequest`",
          "name": "http.ClientRequest",
          "type": "class",
          "meta": {
            "added": [
              "v0.1.17"
            ],
            "changes": []
          },
          "desc": "<ul>\n<li>Extends: <a href=\"http.html#class-httpoutgoingmessage\"><code>&#x3C;http.OutgoingMessage></code></a></li>\n</ul>\n<p>This object is created internally and returned from <a href=\"#httprequestoptions-callback\"><code>http.request()</code></a>. It\nrepresents an <em>in-progress</em> request whose header has already been queued. The\nheader is still mutable using the <a href=\"#requestsetheadername-value\"><code>setHeader(name, value)</code></a>,\n<a href=\"#requestgetheadername\"><code>getHeader(name)</code></a>, <a href=\"#requestremoveheadername\"><code>removeHeader(name)</code></a> API. The actual header will\nbe sent along with the first data chunk or when calling <a href=\"#requestenddata-encoding-callback\"><code>request.end()</code></a>.</p>\n<p>To get the response, add a listener for <a href=\"#event-response\"><code>'response'</code></a> to the request object.\n<a href=\"#event-response\"><code>'response'</code></a> will be emitted from the request object when the response\nheaders have been received. The <a href=\"#event-response\"><code>'response'</code></a> event is executed with one\nargument which is an instance of <a href=\"#class-httpincomingmessage\"><code>http.IncomingMessage</code></a>.</p>\n<p>During the <a href=\"#event-response\"><code>'response'</code></a> event, one can add listeners to the\nresponse object; particularly to listen for the <code>'data'</code> event.</p>\n<p>If no <a href=\"#event-response\"><code>'response'</code></a> handler is added, then the response will be\nentirely discarded. However, if a <a href=\"#event-response\"><code>'response'</code></a> event handler is added,\nthen the data from the response object <strong>must</strong> be consumed, either by\ncalling <code>response.read()</code> whenever there is a <code>'readable'</code> event, or\nby adding a <code>'data'</code> handler, or by calling the <code>.resume()</code> method.\nUntil the data is consumed, the <code>'end'</code> event will not fire. Also, until\nthe data is read it will consume memory that can eventually lead to a\n'process out of memory' error.</p>\n<p>For backward compatibility, <code>res</code> will only emit <code>'error'</code> if there is an\n<code>'error'</code> listener registered.</p>\n<p>Set <code>Content-Length</code> header to limit the response body size.\nIf <a href=\"#responsestrictcontentlength\"><code>response.strictContentLength</code></a> is set to <code>true</code>, mismatching the\n<code>Content-Length</code> header value will result in an <code>Error</code> being thrown,\nidentified by <code>code:</code> <a href=\"errors.html#err_http_content_length_mismatch\"><code>'ERR_HTTP_CONTENT_LENGTH_MISMATCH'</code></a>.</p>\n<p><code>Content-Length</code> value should be in bytes, not characters. Use\n<a href=\"buffer.html#static-method-bufferbytelengthstring-encoding\"><code>Buffer.byteLength()</code></a> to determine the length of the body in bytes.</p>",
          "events": [
            {
              "textRaw": "Event: `'abort'`",
              "name": "abort",
              "type": "event",
              "meta": {
                "added": [
                  "v1.4.1"
                ],
                "changes": [],
                "deprecated": [
                  "v17.0.0",
                  "v16.12.0"
                ]
              },
              "stability": 0,
              "stabilityText": "Deprecated. Listen for the `'close'` event instead.",
              "params": [],
              "desc": "<p>Emitted when the request has been aborted by the client. This event is only\nemitted on the first call to <code>abort()</code>.</p>"
            },
            {
              "textRaw": "Event: `'close'`",
              "name": "close",
              "type": "event",
              "meta": {
                "added": [
                  "v0.5.4"
                ],
                "changes": []
              },
              "params": [],
              "desc": "<p>Indicates that the request is completed, or its underlying connection was\nterminated prematurely (before the response completion).</p>"
            },
            {
              "textRaw": "Event: `'connect'`",
              "name": "connect",
              "type": "event",
              "meta": {
                "added": [
                  "v0.7.0"
                ],
                "changes": []
              },
              "params": [
                {
                  "textRaw": "`response` {http.IncomingMessage}",
                  "name": "response",
                  "type": "http.IncomingMessage"
                },
                {
                  "textRaw": "`socket` {stream.Duplex}",
                  "name": "socket",
                  "type": "stream.Duplex"
                },
                {
                  "textRaw": "`head` {Buffer}",
                  "name": "head",
                  "type": "Buffer"
                }
              ],
              "desc": "<p>Emitted each time a server responds to a request with a <code>CONNECT</code> method. If\nthis event is not being listened for, clients receiving a <code>CONNECT</code> method will\nhave their connections closed.</p>\n<p>This event is guaranteed to be passed an instance of the <a href=\"net.html#class-netsocket\"><code>&#x3C;net.Socket></code></a> class,\na subclass of <a href=\"stream.html#class-streamduplex\"><code>&#x3C;stream.Duplex></code></a>, unless the user specifies a socket\ntype other than <a href=\"net.html#class-netsocket\"><code>&#x3C;net.Socket></code></a>.</p>\n<p>A client and server pair demonstrating how to listen for the <code>'connect'</code> event:</p>\n<pre><code class=\"language-mjs\">import { createServer, request } from 'node:http';\nimport { connect } from 'node:net';\nimport { URL } from 'node:url';\n\n// Create an HTTP tunneling proxy\nconst proxy = createServer((req, res) => {\n  res.writeHead(200, { 'Content-Type': 'text/plain' });\n  res.end('okay');\n});\nproxy.on('connect', (req, clientSocket, head) => {\n  // Connect to an origin server\n  const { port, hostname } = new URL(`http://${req.url}`);\n  const serverSocket = connect(port || 80, hostname, () => {\n    clientSocket.write('HTTP/1.1 200 Connection Established\\r\\n' +\n                    'Proxy-agent: Node.js-Proxy\\r\\n' +\n                    '\\r\\n');\n    serverSocket.write(head);\n    serverSocket.pipe(clientSocket);\n    clientSocket.pipe(serverSocket);\n  });\n});\n\n// Now that proxy is running\nproxy.listen(1337, '127.0.0.1', () => {\n\n  // Make a request to a tunneling proxy\n  const options = {\n    port: 1337,\n    host: '127.0.0.1',\n    method: 'CONNECT',\n    path: 'www.google.com:80',\n  };\n\n  const req = request(options);\n  req.end();\n\n  req.on('connect', (res, socket, head) => {\n    console.log('got connected!');\n\n    // Make a request over an HTTP tunnel\n    socket.write('GET / HTTP/1.1\\r\\n' +\n                 'Host: www.google.com:80\\r\\n' +\n                 'Connection: close\\r\\n' +\n                 '\\r\\n');\n    socket.on('data', (chunk) => {\n      console.log(chunk.toString());\n    });\n    socket.on('end', () => {\n      proxy.close();\n    });\n  });\n});\n</code></pre>\n<pre><code class=\"language-cjs\">const http = require('node:http');\nconst net = require('node:net');\nconst { URL } = require('node:url');\n\n// Create an HTTP tunneling proxy\nconst proxy = http.createServer((req, res) => {\n  res.writeHead(200, { 'Content-Type': 'text/plain' });\n  res.end('okay');\n});\nproxy.on('connect', (req, clientSocket, head) => {\n  // Connect to an origin server\n  const { port, hostname } = new URL(`http://${req.url}`);\n  const serverSocket = net.connect(port || 80, hostname, () => {\n    clientSocket.write('HTTP/1.1 200 Connection Established\\r\\n' +\n                    'Proxy-agent: Node.js-Proxy\\r\\n' +\n                    '\\r\\n');\n    serverSocket.write(head);\n    serverSocket.pipe(clientSocket);\n    clientSocket.pipe(serverSocket);\n  });\n});\n\n// Now that proxy is running\nproxy.listen(1337, '127.0.0.1', () => {\n\n  // Make a request to a tunneling proxy\n  const options = {\n    port: 1337,\n    host: '127.0.0.1',\n    method: 'CONNECT',\n    path: 'www.google.com:80',\n  };\n\n  const req = http.request(options);\n  req.end();\n\n  req.on('connect', (res, socket, head) => {\n    console.log('got connected!');\n\n    // Make a request over an HTTP tunnel\n    socket.write('GET / HTTP/1.1\\r\\n' +\n                 'Host: www.google.com:80\\r\\n' +\n                 'Connection: close\\r\\n' +\n                 '\\r\\n');\n    socket.on('data', (chunk) => {\n      console.log(chunk.toString());\n    });\n    socket.on('end', () => {\n      proxy.close();\n    });\n  });\n});\n</code></pre>"
            },
            {
              "textRaw": "Event: `'continue'`",
              "name": "continue",
              "type": "event",
              "meta": {
                "added": [
                  "v0.3.2"
                ],
                "changes": []
              },
              "params": [],
              "desc": "<p>Emitted when the server sends a '100 Continue' HTTP response, usually because\nthe request contained 'Expect: 100-continue'. This is an instruction that\nthe client should send the request body.</p>"
            },
            {
              "textRaw": "Event: `'finish'`",
              "name": "finish",
              "type": "event",
              "meta": {
                "added": [
                  "v0.3.6"
                ],
                "changes": []
              },
              "params": [],
              "desc": "<p>Emitted when the request has been sent. More specifically, this event is emitted\nwhen the last segment of the request headers and body have been handed off to\nthe operating system for transmission over the network. It does not imply that\nthe server has received anything yet.</p>"
            },
            {
              "textRaw": "Event: `'information'`",
              "name": "information",
              "type": "event",
              "meta": {
                "added": [
                  "v10.0.0"
                ],
                "changes": []
              },
              "params": [
                {
                  "textRaw": "`info` {Object}",
                  "name": "info",
                  "type": "Object",
                  "options": [
                    {
                      "textRaw": "`httpVersion` {string}",
                      "name": "httpVersion",
                      "type": "string"
                    },
                    {
                      "textRaw": "`httpVersionMajor` {integer}",
                      "name": "httpVersionMajor",
                      "type": "integer"
                    },
                    {
                      "textRaw": "`httpVersionMinor` {integer}",
                      "name": "httpVersionMinor",
                      "type": "integer"
                    },
                    {
                      "textRaw": "`statusCode` {integer}",
                      "name": "statusCode",
                      "type": "integer"
                    },
                    {
                      "textRaw": "`statusMessage` {string}",
                      "name": "statusMessage",
                      "type": "string"
                    },
                    {
                      "textRaw": "`headers` {Object}",
                      "name": "headers",
                      "type": "Object"
                    },
                    {
                      "textRaw": "`rawHeaders` {string}[]",
                      "name": "rawHeaders",
                      "type": "string",
                      "desc": "[]"
                    }
                  ]
                }
              ],
              "desc": "<p>Emitted when the server sends a 1xx intermediate response (excluding 101\nUpgrade). The listeners of this event will receive an object containing the\nHTTP version, status code, status message, key-value headers object,\nand array with the raw header names followed by their respective values.</p>\n<pre><code class=\"language-mjs\">import { request } from 'node:http';\n\nconst options = {\n  host: '127.0.0.1',\n  port: 8080,\n  path: '/length_request',\n};\n\n// Make a request\nconst req = request(options);\nreq.end();\n\nreq.on('information', (info) => {\n  console.log(`Got information prior to main response: ${info.statusCode}`);\n});\n</code></pre>\n<pre><code class=\"language-cjs\">const http = require('node:http');\n\nconst options = {\n  host: '127.0.0.1',\n  port: 8080,\n  path: '/length_request',\n};\n\n// Make a request\nconst req = http.request(options);\nreq.end();\n\nreq.on('information', (info) => {\n  console.log(`Got information prior to main response: ${info.statusCode}`);\n});\n</code></pre>\n<p>101 Upgrade statuses do not fire this event due to their break from the\ntraditional HTTP request/response chain, such as web sockets, in-place TLS\nupgrades, or HTTP 2.0. To be notified of 101 Upgrade notices, listen for the\n<a href=\"#event-upgrade\"><code>'upgrade'</code></a> event instead.</p>"
            },
            {
              "textRaw": "Event: `'response'`",
              "name": "response",
              "type": "event",
              "meta": {
                "added": [
                  "v0.1.0"
                ],
                "changes": []
              },
              "params": [
                {
                  "textRaw": "`response` {http.IncomingMessage}",
                  "name": "response",
                  "type": "http.IncomingMessage"
                }
              ],
              "desc": "<p>Emitted when a response is received to this request. This event is emitted only\nonce.</p>"
            },
            {
              "textRaw": "Event: `'socket'`",
              "name": "socket",
              "type": "event",
              "meta": {
                "added": [
                  "v0.5.3"
                ],
                "changes": []
              },
              "params": [
                {
                  "textRaw": "`socket` {stream.Duplex}",
                  "name": "socket",
                  "type": "stream.Duplex"
                }
              ],
              "desc": "<p>This event is guaranteed to be passed an instance of the <a href=\"net.html#class-netsocket\"><code>&#x3C;net.Socket></code></a> class,\na subclass of <a href=\"stream.html#class-streamduplex\"><code>&#x3C;stream.Duplex></code></a>, unless the user specifies a socket\ntype other than <a href=\"net.html#class-netsocket\"><code>&#x3C;net.Socket></code></a>.</p>"
            },
            {
              "textRaw": "Event: `'timeout'`",
              "name": "timeout",
              "type": "event",
              "meta": {
                "added": [
                  "v0.7.8"
                ],
                "changes": []
              },
              "params": [],
              "desc": "<p>Emitted when the underlying socket times out from inactivity. This only notifies\nthat the socket has been idle. The request must be destroyed manually.</p>\n<p>See also: <a href=\"#requestsettimeouttimeout-callback\"><code>request.setTimeout()</code></a>.</p>"
            },
            {
              "textRaw": "Event: `'upgrade'`",
              "name": "upgrade",
              "type": "event",
              "meta": {
                "added": [
                  "v0.1.94"
                ],
                "changes": []
              },
              "params": [
                {
                  "textRaw": "`response` {http.IncomingMessage}",
                  "name": "response",
                  "type": "http.IncomingMessage"
                },
                {
                  "textRaw": "`stream` {stream.Duplex}",
                  "name": "stream",
                  "type": "stream.Duplex"
                },
                {
                  "textRaw": "`head` {Buffer}",
                  "name": "head",
                  "type": "Buffer"
                }
              ],
              "desc": "<p>Emitted each time a server responds to a request with an upgrade. If this\nevent is not being listened for and the response status code is 101 Switching\nProtocols, clients receiving an upgrade header will have their connections\nclosed.</p>\n<p>This event is guaranteed to be passed an instance of the <a href=\"net.html#class-netsocket\"><code>&#x3C;net.Socket></code></a> class,\na subclass of <a href=\"stream.html#class-streamduplex\"><code>&#x3C;stream.Duplex></code></a>, unless the user specifies a socket\ntype other than <a href=\"net.html#class-netsocket\"><code>&#x3C;net.Socket></code></a>.</p>\n<p>A client server pair demonstrating how to listen for the <code>'upgrade'</code> event.</p>\n<pre><code class=\"language-mjs\">import http from 'node:http';\nimport process from 'node:process';\n\n// Create an HTTP server\nconst server = http.createServer((req, res) => {\n  res.writeHead(200, { 'Content-Type': 'text/plain' });\n  res.end('okay');\n});\nserver.on('upgrade', (req, stream, head) => {\n  stream.write('HTTP/1.1 101 Web Socket Protocol Handshake\\r\\n' +\n               'Upgrade: WebSocket\\r\\n' +\n               'Connection: Upgrade\\r\\n' +\n               '\\r\\n');\n\n  stream.pipe(stream); // echo back\n});\n\n// Now that server is running\nserver.listen(1337, '127.0.0.1', () => {\n\n  // make a request\n  const options = {\n    port: 1337,\n    host: '127.0.0.1',\n    headers: {\n      'Connection': 'Upgrade',\n      'Upgrade': 'websocket',\n    },\n  };\n\n  const req = http.request(options);\n  req.end();\n\n  req.on('upgrade', (res, stream, upgradeHead) => {\n    console.log('got upgraded!');\n    stream.end();\n    process.exit(0);\n  });\n});\n</code></pre>\n<pre><code class=\"language-cjs\">const http = require('node:http');\n\n// Create an HTTP server\nconst server = http.createServer((req, res) => {\n  res.writeHead(200, { 'Content-Type': 'text/plain' });\n  res.end('okay');\n});\nserver.on('upgrade', (req, stream, head) => {\n  stream.write('HTTP/1.1 101 Web Socket Protocol Handshake\\r\\n' +\n               'Upgrade: WebSocket\\r\\n' +\n               'Connection: Upgrade\\r\\n' +\n               '\\r\\n');\n\n  stream.pipe(stream); // echo back\n});\n\n// Now that server is running\nserver.listen(1337, '127.0.0.1', () => {\n\n  // make a request\n  const options = {\n    port: 1337,\n    host: '127.0.0.1',\n    headers: {\n      'Connection': 'Upgrade',\n      'Upgrade': 'websocket',\n    },\n  };\n\n  const req = http.request(options);\n  req.end();\n\n  req.on('upgrade', (res, stream, upgradeHead) => {\n    console.log('got upgraded!');\n    stream.end();\n    process.exit(0);\n  });\n});\n</code></pre>"
            }
          ],
          "methods": [
            {
              "textRaw": "`request.abort()`",
              "name": "abort",
              "type": "method",
              "meta": {
                "added": [
                  "v0.3.8"
                ],
                "changes": [],
                "deprecated": [
                  "v14.1.0",
                  "v13.14.0"
                ]
              },
              "stability": 0,
              "stabilityText": "Deprecated: Use `request.destroy()` instead.",
              "signatures": [
                {
                  "params": []
                }
              ],
              "desc": "<p>Marks the request as aborting. Calling this will cause remaining data\nin the response to be dropped and the socket to be destroyed.</p>"
            },
            {
              "textRaw": "`request.cork()`",
              "name": "cork",
              "type": "method",
              "meta": {
                "added": [
                  "v13.2.0",
                  "v12.16.0"
                ],
                "changes": []
              },
              "signatures": [
                {
                  "params": []
                }
              ],
              "desc": "<p>See <a href=\"stream.html#writablecork\"><code>writable.cork()</code></a>.</p>"
            },
            {
              "textRaw": "`request.end([data[, encoding]][, callback])`",
              "name": "end",
              "type": "method",
              "meta": {
                "added": [
                  "v0.1.90"
                ],
                "changes": [
                  {
                    "version": "v15.0.0",
                    "pr-url": "https://github.com/nodejs/node/pull/33155",
                    "description": "The `data` parameter can now be a `Uint8Array`."
                  },
                  {
                    "version": "v10.0.0",
                    "pr-url": "https://github.com/nodejs/node/pull/18780",
                    "description": "This method now returns a reference to `ClientRequest`."
                  }
                ]
              },
              "signatures": [
                {
                  "params": [
                    {
                      "textRaw": "`data` {string|Buffer|Uint8Array}",
                      "name": "data",
                      "type": "string|Buffer|Uint8Array",
                      "optional": true
                    },
                    {
                      "textRaw": "`encoding` {string}",
                      "name": "encoding",
                      "type": "string",
                      "optional": true
                    },
                    {
                      "textRaw": "`callback` {Function}",
                      "name": "callback",
                      "type": "Function",
                      "optional": true
                    }
                  ],
                  "return": {
                    "textRaw": "Returns: {this}",
                    "name": "return",
                    "type": "this"
                  }
                }
              ],
              "desc": "<p>Finishes sending the request. If any parts of the body are\nunsent, it will flush them to the stream. If the request is\nchunked, this will send the terminating <code>'0\\r\\n\\r\\n'</code>.</p>\n<p>If <code>data</code> is specified, it is equivalent to calling\n<a href=\"#requestwritechunk-encoding-callback\"><code>request.write(data, encoding)</code></a> followed by <code>request.end(callback)</code>.</p>\n<p>If <code>callback</code> is specified, it will be called when the request stream\nis finished.</p>"
            },
            {
              "textRaw": "`request.destroy([error])`",
              "name": "destroy",
              "type": "method",
              "meta": {
                "added": [
                  "v0.3.0"
                ],
                "changes": [
                  {
                    "version": "v14.5.0",
                    "pr-url": "https://github.com/nodejs/node/pull/32789",
                    "description": "The function returns `this` for consistency with other Readable streams."
                  }
                ]
              },
              "signatures": [
                {
                  "params": [
                    {
                      "textRaw": "`error` {Error} Optional, an error to emit with `'error'` event.",
                      "name": "error",
                      "type": "Error",
                      "desc": "Optional, an error to emit with `'error'` event.",
                      "optional": true
                    }
                  ],
                  "return": {
                    "textRaw": "Returns: {this}",
                    "name": "return",
                    "type": "this"
                  }
                }
              ],
              "desc": "<p>Destroy the request. Optionally emit an <code>'error'</code> event,\nand emit a <code>'close'</code> event. Calling this will cause remaining data\nin the response to be dropped, and the socket to be destroyed if used,\nor returned to the corresponding Agent pool otherwise if possible.</p>\n<p>See <a href=\"stream.html#writabledestroyerror\"><code>writable.destroy()</code></a> for further details.</p>",
              "properties": [
                {
                  "textRaw": "Type: {boolean}",
                  "name": "destroyed",
                  "type": "boolean",
                  "meta": {
                    "added": [
                      "v14.1.0",
                      "v13.14.0"
                    ],
                    "changes": []
                  },
                  "desc": "<p>Is <code>true</code> after <a href=\"#requestdestroyerror\"><code>request.destroy()</code></a> has been called.</p>\n<p>See <a href=\"stream.html#writabledestroyed\"><code>writable.destroyed</code></a> for further details.</p>"
                }
              ]
            },
            {
              "textRaw": "`request.flushHeaders()`",
              "name": "flushHeaders",
              "type": "method",
              "meta": {
                "added": [
                  "v1.6.0"
                ],
                "changes": []
              },
              "signatures": [
                {
                  "params": []
                }
              ],
              "desc": "<p>Flushes the request headers.</p>\n<p>For efficiency reasons, Node.js normally buffers the request headers until\n<code>request.end()</code> is called or the first chunk of request data is written. It\nthen tries to pack the request headers and data into a single TCP packet.</p>\n<p>That's usually desired (it saves a TCP round-trip), but not when the first\ndata is not sent until possibly much later. <code>request.flushHeaders()</code> bypasses\nthe optimization and kickstarts the request.</p>"
            },
            {
              "textRaw": "`request.getHeader(name)`",
              "name": "getHeader",
              "type": "method",
              "meta": {
                "added": [
                  "v1.6.0"
                ],
                "changes": []
              },
              "signatures": [
                {
                  "params": [
                    {
                      "textRaw": "`name` {string}",
                      "name": "name",
                      "type": "string"
                    }
                  ],
                  "return": {
                    "textRaw": "Returns: {any}",
                    "name": "return",
                    "type": "any"
                  }
                }
              ],
              "desc": "<p>Reads out a header on the request. The name is case-insensitive.\nThe type of the return value depends on the arguments provided to\n<a href=\"#requestsetheadername-value\"><code>request.setHeader()</code></a>.</p>\n<pre><code class=\"language-js\">request.setHeader('content-type', 'text/html');\nrequest.setHeader('Content-Length', Buffer.byteLength(body));\nrequest.setHeader('Cookie', ['type=ninja', 'language=javascript']);\nconst contentType = request.getHeader('Content-Type');\n// 'contentType' is 'text/html'\nconst contentLength = request.getHeader('Content-Length');\n// 'contentLength' is of type number\nconst cookie = request.getHeader('Cookie');\n// 'cookie' is of type string[]\n</code></pre>"
            },
            {
              "textRaw": "`request.getHeaderNames()`",
              "name": "getHeaderNames",
              "type": "method",
              "meta": {
                "added": [
                  "v7.7.0"
                ],
                "changes": []
              },
              "signatures": [
                {
                  "params": [],
                  "return": {
                    "textRaw": "Returns: {string}[]",
                    "name": "return",
                    "type": "string",
                    "desc": "[]"
                  }
                }
              ],
              "desc": "<p>Returns an array containing the unique names of the current outgoing headers.\nAll header names are lowercase.</p>\n<pre><code class=\"language-js\">request.setHeader('Foo', 'bar');\nrequest.setHeader('Cookie', ['foo=bar', 'bar=baz']);\n\nconst headerNames = request.getHeaderNames();\n// headerNames === ['foo', 'cookie']\n</code></pre>"
            },
            {
              "textRaw": "`request.getHeaders()`",
              "name": "getHeaders",
              "type": "method",
              "meta": {
                "added": [
                  "v7.7.0"
                ],
                "changes": []
              },
              "signatures": [
                {
                  "params": [],
                  "return": {
                    "textRaw": "Returns: {Object}",
                    "name": "return",
                    "type": "Object"
                  }
                }
              ],
              "desc": "<p>Returns a shallow copy of the current outgoing headers. Since a shallow copy\nis used, array values may be mutated without additional calls to various\nheader-related http module methods. The keys of the returned object are the\nheader names and the values are the respective header values. All header names\nare lowercase.</p>\n<p>The object returned by the <code>request.getHeaders()</code> method <em>does not</em>\nprototypically inherit from the JavaScript <code>Object</code>. This means that typical\n<code>Object</code> methods such as <code>obj.toString()</code>, <code>obj.hasOwnProperty()</code>, and others\nare not defined and <em>will not work</em>.</p>\n<pre><code class=\"language-js\">request.setHeader('Foo', 'bar');\nrequest.setHeader('Cookie', ['foo=bar', 'bar=baz']);\n\nconst headers = request.getHeaders();\n// headers === { foo: 'bar', 'cookie': ['foo=bar', 'bar=baz'] }\n</code></pre>"
            },
            {
              "textRaw": "`request.getRawHeaderNames()`",
              "name": "getRawHeaderNames",
              "type": "method",
              "meta": {
                "added": [
                  "v15.13.0",
                  "v14.17.0"
                ],
                "changes": []
              },
              "signatures": [
                {
                  "params": [],
                  "return": {
                    "textRaw": "Returns: {string}[]",
                    "name": "return",
                    "type": "string",
                    "desc": "[]"
                  }
                }
              ],
              "desc": "<p>Returns an array containing the unique names of the current outgoing raw\nheaders. Header names are returned with their exact casing being set.</p>\n<pre><code class=\"language-js\">request.setHeader('Foo', 'bar');\nrequest.setHeader('Set-Cookie', ['foo=bar', 'bar=baz']);\n\nconst headerNames = request.getRawHeaderNames();\n// headerNames === ['Foo', 'Set-Cookie']\n</code></pre>"
            },
            {
              "textRaw": "`request.hasHeader(name)`",
              "name": "hasHeader",
              "type": "method",
              "meta": {
                "added": [
                  "v7.7.0"
                ],
                "changes": []
              },
              "signatures": [
                {
                  "params": [
                    {
                      "textRaw": "`name` {string}",
                      "name": "name",
                      "type": "string"
                    }
                  ],
                  "return": {
                    "textRaw": "Returns: {boolean}",
                    "name": "return",
                    "type": "boolean"
                  }
                }
              ],
              "desc": "<p>Returns <code>true</code> if the header identified by <code>name</code> is currently set in the\noutgoing headers. The header name matching is case-insensitive.</p>\n<pre><code class=\"language-js\">const hasContentType = request.hasHeader('content-type');\n</code></pre>"
            },
            {
              "textRaw": "`request.removeHeader(name)`",
              "name": "removeHeader",
              "type": "method",
              "meta": {
                "added": [
                  "v1.6.0"
                ],
                "changes": []
              },
              "signatures": [
                {
                  "params": [
                    {
                      "textRaw": "`name` {string}",
                      "name": "name",
                      "type": "string"
                    }
                  ]
                }
              ],
              "desc": "<p>Removes a header that's already defined into headers object.</p>\n<pre><code class=\"language-js\">request.removeHeader('Content-Type');\n</code></pre>"
            },
            {
              "textRaw": "`request.setHeader(name, value)`",
              "name": "setHeader",
              "type": "method",
              "meta": {
                "added": [
                  "v1.6.0"
                ],
                "changes": []
              },
              "signatures": [
                {
                  "params": [
                    {
                      "textRaw": "`name` {string}",
                      "name": "name",
                      "type": "string"
                    },
                    {
                      "textRaw": "`value` {any}",
                      "name": "value",
                      "type": "any"
                    }
                  ]
                }
              ],
              "desc": "<p>Sets a single header value for headers object. If this header already exists in\nthe to-be-sent headers, its value will be replaced. Use an array of strings\nhere to send multiple headers with the same name. Non-string values will be\nstored without modification. Therefore, <a href=\"#requestgetheadername\"><code>request.getHeader()</code></a> may return\nnon-string values. However, the non-string values will be converted to strings\nfor network transmission.</p>\n<pre><code class=\"language-js\">request.setHeader('Content-Type', 'application/json');\n</code></pre>\n<p>or</p>\n<pre><code class=\"language-js\">request.setHeader('Cookie', ['type=ninja', 'language=javascript']);\n</code></pre>\n<p>When the value is a string an exception will be thrown if it contains\ncharacters outside the <code>latin1</code> encoding.</p>\n<p>If you need to pass UTF-8 characters in the value please encode the value\nusing the <a href=\"https://www.rfc-editor.org/rfc/rfc8187.txt\">RFC 8187</a> standard.</p>\n<pre><code class=\"language-js\">const filename = 'Rock 🎵.txt';\nrequest.setHeader('Content-Disposition', `attachment; filename*=utf-8''${encodeURIComponent(filename)}`);\n</code></pre>"
            },
            {
              "textRaw": "`request.setNoDelay([noDelay])`",
              "name": "setNoDelay",
              "type": "method",
              "meta": {
                "added": [
                  "v0.5.9"
                ],
                "changes": []
              },
              "signatures": [
                {
                  "params": [
                    {
                      "textRaw": "`noDelay` {boolean}",
                      "name": "noDelay",
                      "type": "boolean",
                      "optional": true
                    }
                  ]
                }
              ],
              "desc": "<p>Once a socket is assigned to this request and is connected\n<a href=\"net.html#socketsetnodelaynodelay\"><code>socket.setNoDelay()</code></a> will be called.</p>"
            },
            {
              "textRaw": "`request.setSocketKeepAlive([enable][, initialDelay])`",
              "name": "setSocketKeepAlive",
              "type": "method",
              "meta": {
                "added": [
                  "v0.5.9"
                ],
                "changes": []
              },
              "signatures": [
                {
                  "params": [
                    {
                      "textRaw": "`enable` {boolean}",
                      "name": "enable",
                      "type": "boolean",
                      "optional": true
                    },
                    {
                      "textRaw": "`initialDelay` {number}",
                      "name": "initialDelay",
                      "type": "number",
                      "optional": true
                    }
                  ]
                }
              ],
              "desc": "<p>Once a socket is assigned to this request and is connected\n<a href=\"net.html#socketsetkeepalive\"><code>socket.setKeepAlive()</code></a> will be called.</p>"
            },
            {
              "textRaw": "`request.setTimeout(timeout[, callback])`",
              "name": "setTimeout",
              "type": "method",
              "meta": {
                "added": [
                  "v0.5.9"
                ],
                "changes": [
                  {
                    "version": "v9.0.0",
                    "pr-url": "https://github.com/nodejs/node/pull/8895",
                    "description": "Consistently set socket timeout only when the socket connects."
                  }
                ]
              },
              "signatures": [
                {
                  "params": [
                    {
                      "textRaw": "`timeout` {number} Milliseconds before a request times out.",
                      "name": "timeout",
                      "type": "number",
                      "desc": "Milliseconds before a request times out."
                    },
                    {
                      "textRaw": "`callback` {Function} Optional function to be called when a timeout occurs. Same as binding to the `'timeout'` event.",
                      "name": "callback",
                      "type": "Function",
                      "desc": "Optional function to be called when a timeout occurs. Same as binding to the `'timeout'` event.",
                      "optional": true
                    }
                  ],
                  "return": {
                    "textRaw": "Returns: {http.ClientRequest}",
                    "name": "return",
                    "type": "http.ClientRequest"
                  }
                }
              ],
              "desc": "<p>Once a socket is assigned to this request and is connected\n<a href=\"net.html#socketsettimeouttimeout-callback\"><code>socket.setTimeout()</code></a> will be called.</p>"
            },
            {
              "textRaw": "`request.uncork()`",
              "name": "uncork",
              "type": "method",
              "meta": {
                "added": [
                  "v13.2.0",
                  "v12.16.0"
                ],
                "changes": []
              },
              "signatures": [
                {
                  "params": []
                }
              ],
              "desc": "<p>See <a href=\"stream.html#writableuncork\"><code>writable.uncork()</code></a>.</p>"
            },
            {
              "textRaw": "`request.write(chunk[, encoding][, callback])`",
              "name": "write",
              "type": "method",
              "meta": {
                "added": [
                  "v0.1.29"
                ],
                "changes": [
                  {
                    "version": "v15.0.0",
                    "pr-url": "https://github.com/nodejs/node/pull/33155",
                    "description": "The `chunk` parameter can now be a `Uint8Array`."
                  }
                ]
              },
              "signatures": [
                {
                  "params": [
                    {
                      "textRaw": "`chunk` {string|Buffer|Uint8Array}",
                      "name": "chunk",
                      "type": "string|Buffer|Uint8Array"
                    },
                    {
                      "textRaw": "`encoding` {string}",
                      "name": "encoding",
                      "type": "string",
                      "optional": true
                    },
                    {
                      "textRaw": "`callback` {Function}",
                      "name": "callback",
                      "type": "Function",
                      "optional": true
                    }
                  ],
                  "return": {
                    "textRaw": "Returns: {boolean}",
                    "name": "return",
                    "type": "boolean"
                  }
                }
              ],
              "desc": "<p>Sends a chunk of the body. This method can be called multiple times. If no\n<code>Content-Length</code> is set, data will automatically be encoded in HTTP Chunked\ntransfer encoding, so that server knows when the data ends. The\n<code>Transfer-Encoding: chunked</code> header is added. Calling <a href=\"#requestenddata-encoding-callback\"><code>request.end()</code></a>\nis necessary to finish sending the request.</p>\n<p>The <code>encoding</code> argument is optional and only applies when <code>chunk</code> is a string.\nDefaults to <code>'utf8'</code>.</p>\n<p>The <code>callback</code> argument is optional and will be called when this chunk of data\nis flushed, but only if the chunk is non-empty.</p>\n<p>Returns <code>true</code> if the entire data was flushed successfully to the kernel\nbuffer. Returns <code>false</code> if all or part of the data was queued in user memory.\n<code>'drain'</code> will be emitted when the buffer is free again.</p>\n<p>When <code>write</code> function is called with empty string or buffer, it does\nnothing and waits for more input.</p>"
            }
          ],
          "properties": [
            {
              "textRaw": "Type: {boolean}",
              "name": "aborted",
              "type": "boolean",
              "meta": {
                "added": [
                  "v0.11.14"
                ],
                "changes": [
                  {
                    "version": "v11.0.0",
                    "pr-url": "https://github.com/nodejs/node/pull/20230",
                    "description": "The `aborted` property is no longer a timestamp number."
                  }
                ],
                "deprecated": [
                  "v17.0.0",
                  "v16.12.0"
                ]
              },
              "stability": 0,
              "stabilityText": "Deprecated. Check `request.destroyed` instead.",
              "desc": "<p>The <code>request.aborted</code> property will be <code>true</code> if the request has\nbeen aborted.</p>"
            },
            {
              "textRaw": "Type: {stream.Duplex}",
              "name": "connection",
              "type": "stream.Duplex",
              "meta": {
                "added": [
                  "v0.3.0"
                ],
                "changes": [],
                "deprecated": [
                  "v13.0.0"
                ]
              },
              "stability": 0,
              "stabilityText": "Deprecated. Use `request.socket`.",
              "desc": "<p>See <a href=\"#requestsocket\"><code>request.socket</code></a>.</p>"
            },
            {
              "textRaw": "Type: {boolean}",
              "name": "finished",
              "type": "boolean",
              "meta": {
                "added": [
                  "v0.0.1"
                ],
                "changes": [],
                "deprecated": [
                  "v13.4.0",
                  "v12.16.0"
                ]
              },
              "stability": 0,
              "stabilityText": "Deprecated. Use `request.writableEnded`.",
              "desc": "<p>The <code>request.finished</code> property will be <code>true</code> if <a href=\"#requestenddata-encoding-callback\"><code>request.end()</code></a>\nhas been called. <code>request.end()</code> will automatically be called if the\nrequest was initiated via <a href=\"#httpgetoptions-callback\"><code>http.get()</code></a>.</p>"
            },
            {
              "textRaw": "Type: {number} **Default:** `2000`",
              "name": "maxHeadersCount",
              "type": "number",
              "default": "`2000`",
              "desc": "<p>Limits maximum response headers count. If set to 0, no limit will be applied.</p>"
            },
            {
              "textRaw": "Type: {string} The request path.",
              "name": "path",
              "type": "string",
              "meta": {
                "added": [
                  "v0.4.0"
                ],
                "changes": []
              },
              "desc": "The request path."
            },
            {
              "textRaw": "Type: {string} The request method.",
              "name": "method",
              "type": "string",
              "meta": {
                "added": [
                  "v0.1.97"
                ],
                "changes": []
              },
              "desc": "The request method."
            },
            {
              "textRaw": "Type: {string} The request host.",
              "name": "host",
              "type": "string",
              "meta": {
                "added": [
                  "v14.5.0",
                  "v12.19.0"
                ],
                "changes": []
              },
              "desc": "The request host."
            },
            {
              "textRaw": "Type: {string} The request protocol.",
              "name": "protocol",
              "type": "string",
              "meta": {
                "added": [
                  "v14.5.0",
                  "v12.19.0"
                ],
                "changes": []
              },
              "desc": "The request protocol."
            },
            {
              "textRaw": "Type: {boolean} Whether the request is send through a reused socket.",
              "name": "reusedSocket",
              "type": "boolean",
              "meta": {
                "added": [
                  "v13.0.0",
                  "v12.16.0"
                ],
                "changes": []
              },
              "desc": "<p>When sending request through a keep-alive enabled agent, the underlying socket\nmight be reused. But if server closes connection at unfortunate time, client\nmay run into a 'ECONNRESET' error.</p>\n<pre><code class=\"language-mjs\">import http from 'node:http';\nconst agent = new http.Agent({ keepAlive: true });\n\n// Server has a 5 seconds keep-alive timeout by default\nhttp\n  .createServer((req, res) => {\n    res.write('hello\\n');\n    res.end();\n  })\n  .listen(3000);\n\nsetInterval(() => {\n  // Adapting a keep-alive agent\n  http.get('http://localhost:3000', { agent }, (res) => {\n    res.on('data', (data) => {\n      // Do nothing\n    });\n  });\n}, 5000); // Sending request on 5s interval so it's easy to hit idle timeout\n</code></pre>\n<pre><code class=\"language-cjs\">const http = require('node:http');\nconst agent = new http.Agent({ keepAlive: true });\n\n// Server has a 5 seconds keep-alive timeout by default\nhttp\n  .createServer((req, res) => {\n    res.write('hello\\n');\n    res.end();\n  })\n  .listen(3000);\n\nsetInterval(() => {\n  // Adapting a keep-alive agent\n  http.get('http://localhost:3000', { agent }, (res) => {\n    res.on('data', (data) => {\n      // Do nothing\n    });\n  });\n}, 5000); // Sending request on 5s interval so it's easy to hit idle timeout\n</code></pre>\n<p>By marking a request whether it reused socket or not, we can do\nautomatic error retry base on it.</p>\n<pre><code class=\"language-mjs\">import http from 'node:http';\nconst agent = new http.Agent({ keepAlive: true });\n\nfunction retriableRequest() {\n  const req = http\n    .get('http://localhost:3000', { agent }, (res) => {\n      // ...\n    })\n    .on('error', (err) => {\n      // Check if retry is needed\n      if (req.reusedSocket &#x26;&#x26; err.code === 'ECONNRESET') {\n        retriableRequest();\n      }\n    });\n}\n\nretriableRequest();\n</code></pre>\n<pre><code class=\"language-cjs\">const http = require('node:http');\nconst agent = new http.Agent({ keepAlive: true });\n\nfunction retriableRequest() {\n  const req = http\n    .get('http://localhost:3000', { agent }, (res) => {\n      // ...\n    })\n    .on('error', (err) => {\n      // Check if retry is needed\n      if (req.reusedSocket &#x26;&#x26; err.code === 'ECONNRESET') {\n        retriableRequest();\n      }\n    });\n}\n\nretriableRequest();\n</code></pre>",
              "shortDesc": "Whether the request is send through a reused socket."
            },
            {
              "textRaw": "Type: {stream.Duplex}",
              "name": "socket",
              "type": "stream.Duplex",
              "meta": {
                "added": [
                  "v0.3.0"
                ],
                "changes": []
              },
              "desc": "<p>Reference to the underlying socket. Usually users will not want to access\nthis property. In particular, the socket will not emit <code>'readable'</code> events\nbecause of how the protocol parser attaches to the socket.</p>\n<pre><code class=\"language-mjs\">import http from 'node:http';\nconst options = {\n  host: 'www.google.com',\n};\nconst req = http.get(options);\nreq.end();\nreq.once('response', (res) => {\n  const ip = req.socket.localAddress;\n  const port = req.socket.localPort;\n  console.log(`Your IP address is ${ip} and your source port is ${port}.`);\n  // Consume response object\n});\n</code></pre>\n<pre><code class=\"language-cjs\">const http = require('node:http');\nconst options = {\n  host: 'www.google.com',\n};\nconst req = http.get(options);\nreq.end();\nreq.once('response', (res) => {\n  const ip = req.socket.localAddress;\n  const port = req.socket.localPort;\n  console.log(`Your IP address is ${ip} and your source port is ${port}.`);\n  // Consume response object\n});\n</code></pre>\n<p>This property is guaranteed to be an instance of the <a href=\"net.html#class-netsocket\"><code>&#x3C;net.Socket></code></a> class,\na subclass of <a href=\"stream.html#class-streamduplex\"><code>&#x3C;stream.Duplex></code></a>, unless the user specified a socket\ntype other than <a href=\"net.html#class-netsocket\"><code>&#x3C;net.Socket></code></a>.</p>"
            },
            {
              "textRaw": "Type: {boolean}",
              "name": "writableEnded",
              "type": "boolean",
              "meta": {
                "added": [
                  "v12.9.0"
                ],
                "changes": []
              },
              "desc": "<p>Is <code>true</code> after <a href=\"#requestenddata-encoding-callback\"><code>request.end()</code></a> has been called. This property\ndoes not indicate whether the data has been flushed, for this use\n<a href=\"#requestwritablefinished\"><code>request.writableFinished</code></a> instead.</p>"
            },
            {
              "textRaw": "Type: {boolean}",
              "name": "writableFinished",
              "type": "boolean",
              "meta": {
                "added": [
                  "v12.7.0"
                ],
                "changes": []
              },
              "desc": "<p>Is <code>true</code> if all data has been flushed to the underlying system, immediately\nbefore the <a href=\"#event-finish\"><code>'finish'</code></a> event is emitted.</p>"
            }
          ]
        },
        {
          "textRaw": "Class: `http.Server`",
          "name": "http.Server",
          "type": "class",
          "meta": {
            "added": [
              "v0.1.17"
            ],
            "changes": []
          },
          "desc": "<ul>\n<li>Extends: <a href=\"net.html#class-netserver\"><code>&#x3C;net.Server></code></a></li>\n</ul>",
          "events": [
            {
              "textRaw": "Event: `'checkContinue'`",
              "name": "checkContinue",
              "type": "event",
              "meta": {
                "added": [
                  "v0.3.0"
                ],
                "changes": []
              },
              "params": [
                {
                  "textRaw": "`request` {http.IncomingMessage}",
                  "name": "request",
                  "type": "http.IncomingMessage"
                },
                {
                  "textRaw": "`response` {http.ServerResponse}",
                  "name": "response",
                  "type": "http.ServerResponse"
                }
              ],
              "desc": "<p>Emitted each time a request with an HTTP <code>Expect: 100-continue</code> is received.\nIf this event is not listened for, the server will automatically respond\nwith a <code>100 Continue</code> as appropriate.</p>\n<p>Handling this event involves calling <a href=\"#responsewritecontinue\"><code>response.writeContinue()</code></a> if the\nclient should continue to send the request body, or generating an appropriate\nHTTP response (e.g. 400 Bad Request) if the client should not continue to send\nthe request body.</p>\n<p>When this event is emitted and handled, the <a href=\"#event-request\"><code>'request'</code></a> event will\nnot be emitted.</p>"
            },
            {
              "textRaw": "Event: `'checkExpectation'`",
              "name": "checkExpectation",
              "type": "event",
              "meta": {
                "added": [
                  "v5.5.0"
                ],
                "changes": []
              },
              "params": [
                {
                  "textRaw": "`request` {http.IncomingMessage}",
                  "name": "request",
                  "type": "http.IncomingMessage"
                },
                {
                  "textRaw": "`response` {http.ServerResponse}",
                  "name": "response",
                  "type": "http.ServerResponse"
                }
              ],
              "desc": "<p>Emitted each time a request with an HTTP <code>Expect</code> header is received, where the\nvalue is not <code>100-continue</code>. If this event is not listened for, the server will\nautomatically respond with a <code>417 Expectation Failed</code> as appropriate.</p>\n<p>When this event is emitted and handled, the <a href=\"#event-request\"><code>'request'</code></a> event will\nnot be emitted.</p>"
            },
            {
              "textRaw": "Event: `'clientError'`",
              "name": "clientError",
              "type": "event",
              "meta": {
                "added": [
                  "v0.1.94"
                ],
                "changes": [
                  {
                    "version": "v12.0.0",
                    "pr-url": "https://github.com/nodejs/node/pull/25605",
                    "description": "The default behavior will return a 431 Request Header Fields Too Large if an HPE_HEADER_OVERFLOW error occurs."
                  },
                  {
                    "version": "v9.4.0",
                    "pr-url": "https://github.com/nodejs/node/pull/17672",
                    "description": "The `rawPacket` is the current buffer that just parsed. Adding this buffer to the error object of `'clientError'` event is to make it possible that developers can log the broken packet."
                  },
                  {
                    "version": "v6.0.0",
                    "pr-url": "https://github.com/nodejs/node/pull/4557",
                    "description": "The default action of calling `.destroy()` on the `socket` will no longer take place if there are listeners attached for `'clientError'`."
                  }
                ]
              },
              "params": [
                {
                  "textRaw": "`exception` {Error}",
                  "name": "exception",
                  "type": "Error"
                },
                {
                  "textRaw": "`socket` {stream.Duplex}",
                  "name": "socket",
                  "type": "stream.Duplex"
                }
              ],
              "desc": "<p>If a client connection emits an <code>'error'</code> event, it will be forwarded here.\nListener of this event is responsible for closing/destroying the underlying\nsocket. For example, one may wish to more gracefully close the socket with a\ncustom HTTP response instead of abruptly severing the connection. The socket\n<strong>must be closed or destroyed</strong> before the listener ends.</p>\n<p>This event is guaranteed to be passed an instance of the <a href=\"net.html#class-netsocket\"><code>&#x3C;net.Socket></code></a> class,\na subclass of <a href=\"stream.html#class-streamduplex\"><code>&#x3C;stream.Duplex></code></a>, unless the user specifies a socket\ntype other than <a href=\"net.html#class-netsocket\"><code>&#x3C;net.Socket></code></a>.</p>\n<p>Default behavior is to try close the socket with an HTTP '400 Bad Request',\nor an HTTP '431 Request Header Fields Too Large' in the case of an\n<a href=\"errors.html#hpe_header_overflow\"><code>HPE_HEADER_OVERFLOW</code></a> error. If the socket is not writable or headers\nof the current attached <a href=\"#class-httpserverresponse\"><code>http.ServerResponse</code></a> has been sent, it is\nimmediately destroyed.</p>\n<p><code>socket</code> is the <a href=\"net.html#class-netsocket\"><code>net.Socket</code></a> object that the error originated from.</p>\n<pre><code class=\"language-mjs\">import http from 'node:http';\n\nconst server = http.createServer((req, res) => {\n  res.end();\n});\nserver.on('clientError', (err, socket) => {\n  socket.end('HTTP/1.1 400 Bad Request\\r\\n\\r\\n');\n});\nserver.listen(8000);\n</code></pre>\n<pre><code class=\"language-cjs\">const http = require('node:http');\n\nconst server = http.createServer((req, res) => {\n  res.end();\n});\nserver.on('clientError', (err, socket) => {\n  socket.end('HTTP/1.1 400 Bad Request\\r\\n\\r\\n');\n});\nserver.listen(8000);\n</code></pre>\n<p>When the <code>'clientError'</code> event occurs, there is no <code>request</code> or <code>response</code>\nobject, so any HTTP response sent, including response headers and payload,\n<em>must</em> be written directly to the <code>socket</code> object. Care must be taken to\nensure the response is a properly formatted HTTP response message.</p>\n<p><code>err</code> is an instance of <code>Error</code> with two extra columns:</p>\n<ul>\n<li><code>bytesParsed</code>: the bytes count of request packet that Node.js may have parsed\ncorrectly;</li>\n<li><code>rawPacket</code>: the raw packet of current request.</li>\n</ul>\n<p>In some cases, the client has already received the response and/or the socket\nhas already been destroyed, like in case of <code>ECONNRESET</code> errors. Before\ntrying to send data to the socket, it is better to check that it is still\nwritable.</p>\n<pre><code class=\"language-js\">server.on('clientError', (err, socket) => {\n  if (err.code === 'ECONNRESET' || !socket.writable) {\n    return;\n  }\n\n  socket.end('HTTP/1.1 400 Bad Request\\r\\n\\r\\n');\n});\n</code></pre>"
            },
            {
              "textRaw": "Event: `'close'`",
              "name": "close",
              "type": "event",
              "meta": {
                "added": [
                  "v0.1.4"
                ],
                "changes": []
              },
              "params": [],
              "desc": "<p>Emitted when the server closes.</p>"
            },
            {
              "textRaw": "Event: `'connect'`",
              "name": "connect",
              "type": "event",
              "meta": {
                "added": [
                  "v0.7.0"
                ],
                "changes": []
              },
              "params": [
                {
                  "textRaw": "`request` {http.IncomingMessage} Arguments for the HTTP request, as it is in the `'request'` event",
                  "name": "request",
                  "type": "http.IncomingMessage",
                  "desc": "Arguments for the HTTP request, as it is in the `'request'` event"
                },
                {
                  "textRaw": "`socket` {stream.Duplex} Network socket between the server and client",
                  "name": "socket",
                  "type": "stream.Duplex",
                  "desc": "Network socket between the server and client"
                },
                {
                  "textRaw": "`head` {Buffer} The first packet of the tunneling stream (may be empty)",
                  "name": "head",
                  "type": "Buffer",
                  "desc": "The first packet of the tunneling stream (may be empty)"
                }
              ],
              "desc": "<p>Emitted each time a client requests an HTTP <code>CONNECT</code> method. If this event is\nnot listened for, then clients requesting a <code>CONNECT</code> method will have their\nconnections closed.</p>\n<p>This event is guaranteed to be passed an instance of the <a href=\"net.html#class-netsocket\"><code>&#x3C;net.Socket></code></a> class,\na subclass of <a href=\"stream.html#class-streamduplex\"><code>&#x3C;stream.Duplex></code></a>, unless the user specifies a socket\ntype other than <a href=\"net.html#class-netsocket\"><code>&#x3C;net.Socket></code></a>.</p>\n<p>After this event is emitted, the request's socket will not have a <code>'data'</code>\nevent listener, meaning it will need to be bound in order to handle data\nsent to the server on that socket.</p>"
            },
            {
              "textRaw": "Event: `'connection'`",
              "name": "connection",
              "type": "event",
              "meta": {
                "added": [
                  "v0.1.0"
                ],
                "changes": []
              },
              "params": [
                {
                  "textRaw": "`socket` {stream.Duplex}",
                  "name": "socket",
                  "type": "stream.Duplex"
                }
              ],
              "desc": "<p>This event is emitted when a new TCP stream is established. <code>socket</code> is\ntypically an object of type <a href=\"net.html#class-netsocket\"><code>net.Socket</code></a>. Usually users will not want to\naccess this event. In particular, the socket will not emit <code>'readable'</code> events\nbecause of how the protocol parser attaches to the socket. The <code>socket</code> can\nalso be accessed at <code>request.socket</code>.</p>\n<p>This event can also be explicitly emitted by users to inject connections\ninto the HTTP server. In that case, any <a href=\"stream.html#class-streamduplex\"><code>Duplex</code></a> stream can be passed.</p>\n<p>If <code>socket.setTimeout()</code> is called here, the timeout will be replaced with\n<code>server.keepAliveTimeout</code> when the socket has served a request (if\n<code>server.keepAliveTimeout</code> is non-zero).</p>\n<p>This event is guaranteed to be passed an instance of the <a href=\"net.html#class-netsocket\"><code>&#x3C;net.Socket></code></a> class,\na subclass of <a href=\"stream.html#class-streamduplex\"><code>&#x3C;stream.Duplex></code></a>, unless the user specifies a socket\ntype other than <a href=\"net.html#class-netsocket\"><code>&#x3C;net.Socket></code></a>.</p>"
            },
            {
              "textRaw": "Event: `'dropRequest'`",
              "name": "dropRequest",
              "type": "event",
              "meta": {
                "added": [
                  "v18.7.0",
                  "v16.17.0"
                ],
                "changes": []
              },
              "params": [
                {
                  "textRaw": "`request` {http.IncomingMessage} Arguments for the HTTP request, as it is in the `'request'` event",
                  "name": "request",
                  "type": "http.IncomingMessage",
                  "desc": "Arguments for the HTTP request, as it is in the `'request'` event"
                },
                {
                  "textRaw": "`socket` {stream.Duplex} Network socket between the server and client",
                  "name": "socket",
                  "type": "stream.Duplex",
                  "desc": "Network socket between the server and client"
                }
              ],
              "desc": "<p>When the number of requests on a socket reaches the threshold of\n<code>server.maxRequestsPerSocket</code>, the server will drop new requests\nand emit <code>'dropRequest'</code> event instead, then send <code>503</code> to client.</p>"
            },
            {
              "textRaw": "Event: `'request'`",
              "name": "request",
              "type": "event",
              "meta": {
                "added": [
                  "v0.1.0"
                ],
                "changes": []
              },
              "params": [
                {
                  "textRaw": "`request` {http.IncomingMessage}",
                  "name": "request",
                  "type": "http.IncomingMessage"
                },
                {
                  "textRaw": "`response` {http.ServerResponse}",
                  "name": "response",
                  "type": "http.ServerResponse"
                }
              ],
              "desc": "<p>Emitted each time there is a request. There may be multiple requests\nper connection (in the case of HTTP Keep-Alive connections).</p>"
            },
            {
              "textRaw": "Event: `'upgrade'`",
              "name": "upgrade",
              "type": "event",
              "meta": {
                "added": [
                  "v0.1.94"
                ],
                "changes": [
                  {
                    "version": "v26.0.0",
                    "pr-url": "https://github.com/nodejs/node/pull/60016",
                    "description": "Request bodies are no longer exposed raw (unparsed) on the socket argument. Instead, if a body is received, the stream argument will be a duplex that emits socket content only after the request body, while the parsed request body data will be emitted from the request, just as in normal server `'request'` events."
                  },
                  {
                    "version": [
                      "v24.9.0",
                      "v22.21.0"
                    ],
                    "pr-url": "https://github.com/nodejs/node/pull/59824",
                    "description": "Whether this event is fired can now be controlled by the `shouldUpgradeCallback` and sockets will be destroyed if upgraded while no event handler is listening."
                  },
                  {
                    "version": "v10.0.0",
                    "pr-url": "https://github.com/nodejs/node/pull/19981",
                    "description": "Not listening to this event no longer causes the socket to be destroyed if a client sends an Upgrade header."
                  }
                ]
              },
              "params": [
                {
                  "textRaw": "`request` {http.IncomingMessage} Arguments for the HTTP request, as it is in the `'request'` event",
                  "name": "request",
                  "type": "http.IncomingMessage",
                  "desc": "Arguments for the HTTP request, as it is in the `'request'` event"
                },
                {
                  "textRaw": "`stream` {stream.Duplex} The upgraded stream between the server and client",
                  "name": "stream",
                  "type": "stream.Duplex",
                  "desc": "The upgraded stream between the server and client"
                },
                {
                  "textRaw": "`head` {Buffer} The first packet of the upgraded stream (may be empty)",
                  "name": "head",
                  "type": "Buffer",
                  "desc": "The first packet of the upgraded stream (may be empty)"
                }
              ],
              "desc": "<p>Emitted each time a client's HTTP upgrade request is accepted. By default\nall HTTP upgrade requests are ignored (i.e. only regular <code>'request'</code> events\nare emitted, sticking with the normal HTTP request/response flow) unless you\nlisten to this event, in which case they are all accepted (i.e. the <code>'upgrade'</code>\nevent is emitted instead, and future communication must handled directly\nthrough the raw stream). You can control this more precisely by using the\nserver <code>shouldUpgradeCallback</code> option.</p>\n<p>Listening to this event is optional and clients cannot insist on a protocol\nchange.</p>\n<p>If an upgrade is accepted by <code>shouldUpgradeCallback</code> but no event handler\nis registered then the socket will be destroyed, resulting in an immediate\nconnection closure for the client.</p>\n<p>In the uncommon case that the incoming request has a body, this body will be\nparsed as normal, separate to the upgrade stream, and the raw stream data will\nonly begin after it has completed. To ensure that reading from the stream isn't\nblocked by waiting for the request body to be read, any reads on the stream\nwill start the request body flowing automatically. If you want to read the\nrequest body, ensure that you do so (i.e. you attach <code>'data'</code> listeners)\nbefore starting to read from the upgraded stream.</p>\n<p>The stream argument will typically be the <a href=\"net.html#class-netsocket\"><code>&#x3C;net.Socket></code></a> instance used by the\nrequest, but in some cases (such as with a request body) it may be a duplex\nstream. If required, you can access the raw connection underlying the request\nvia <a href=\"#requestsocket\"><code>request.socket</code></a>, which is guaranteed to be an instance of <a href=\"net.html#class-netsocket\"><code>&#x3C;net.Socket></code></a>\nunless the user specified another socket type.</p>"
            }
          ],
          "methods": [
            {
              "textRaw": "`server.close([callback])`",
              "name": "close",
              "type": "method",
              "meta": {
                "added": [
                  "v0.1.90"
                ],
                "changes": [
                  {
                    "version": [
                      "v19.0.0"
                    ],
                    "pr-url": "https://github.com/nodejs/node/pull/43522",
                    "description": "The method closes idle connections before returning."
                  }
                ]
              },
              "signatures": [
                {
                  "params": [
                    {
                      "textRaw": "`callback` {Function}",
                      "name": "callback",
                      "type": "Function",
                      "optional": true
                    }
                  ]
                }
              ],
              "desc": "<p>Stops the server from accepting new connections and closes all connections\nconnected to this server which are not sending a request or waiting for\na response.\nSee <a href=\"net.html#serverclosecallback\"><code>net.Server.close()</code></a>.</p>\n<pre><code class=\"language-js\">const http = require('node:http');\n\nconst server = http.createServer({ keepAliveTimeout: 60000 }, (req, res) => {\n  res.writeHead(200, { 'Content-Type': 'application/json' });\n  res.end(JSON.stringify({\n    data: 'Hello World!',\n  }));\n});\n\nserver.listen(8000);\n// Close the server after 10 seconds\nsetTimeout(() => {\n  server.close(() => {\n    console.log('server on port 8000 closed successfully');\n  });\n}, 10000);\n</code></pre>"
            },
            {
              "textRaw": "`server.closeAllConnections()`",
              "name": "closeAllConnections",
              "type": "method",
              "meta": {
                "added": [
                  "v18.2.0"
                ],
                "changes": []
              },
              "signatures": [
                {
                  "params": []
                }
              ],
              "desc": "<p>Closes all established HTTP(S) connections connected to this server, including\nactive connections connected to this server which are sending a request or\nwaiting for a response. This does <em>not</em> destroy sockets upgraded to a different\nprotocol, such as WebSocket or HTTP/2.</p>\n<blockquote>\n<p>This is a forceful way of closing all connections and should be used with\ncaution. Whenever using this in conjunction with <code>server.close</code>, calling this\n<em>after</em> <code>server.close</code> is recommended as to avoid race conditions where new\nconnections are created between a call to this and a call to <code>server.close</code>.</p>\n</blockquote>\n<pre><code class=\"language-js\">const http = require('node:http');\n\nconst server = http.createServer({ keepAliveTimeout: 60000 }, (req, res) => {\n  res.writeHead(200, { 'Content-Type': 'application/json' });\n  res.end(JSON.stringify({\n    data: 'Hello World!',\n  }));\n});\n\nserver.listen(8000);\n// Close the server after 10 seconds\nsetTimeout(() => {\n  server.close(() => {\n    console.log('server on port 8000 closed successfully');\n  });\n  // Closes all connections, ensuring the server closes successfully\n  server.closeAllConnections();\n}, 10000);\n</code></pre>"
            },
            {
              "textRaw": "`server.closeIdleConnections()`",
              "name": "closeIdleConnections",
              "type": "method",
              "meta": {
                "added": [
                  "v18.2.0"
                ],
                "changes": []
              },
              "signatures": [
                {
                  "params": []
                }
              ],
              "desc": "<p>Closes all connections connected to this server which are not sending a request\nor waiting for a response.</p>\n<blockquote>\n<p>Starting with Node.js 19.0.0, there's no need for calling this method in\nconjunction with <code>server.close</code> to reap <code>keep-alive</code> connections. Using it\nwon't cause any harm though, and it can be useful to ensure backwards\ncompatibility for libraries and applications that need to support versions\nolder than 19.0.0. Whenever using this in conjunction with <code>server.close</code>,\ncalling this <em>after</em> <code>server.close</code> is recommended as to avoid race\nconditions where new connections are created between a call to this and a\ncall to <code>server.close</code>.</p>\n</blockquote>\n<pre><code class=\"language-js\">const http = require('node:http');\n\nconst server = http.createServer({ keepAliveTimeout: 60000 }, (req, res) => {\n  res.writeHead(200, { 'Content-Type': 'application/json' });\n  res.end(JSON.stringify({\n    data: 'Hello World!',\n  }));\n});\n\nserver.listen(8000);\n// Close the server after 10 seconds\nsetTimeout(() => {\n  server.close(() => {\n    console.log('server on port 8000 closed successfully');\n  });\n  // Closes idle connections, such as keep-alive connections. Server will close\n  // once remaining active connections are terminated\n  server.closeIdleConnections();\n}, 10000);\n</code></pre>"
            },
            {
              "textRaw": "`server.listen()`",
              "name": "listen",
              "type": "method",
              "signatures": [
                {
                  "params": []
                }
              ],
              "desc": "<p>Starts the HTTP server listening for connections.\nThis method is identical to <a href=\"net.html#serverlisten\"><code>server.listen()</code></a> from <a href=\"net.html#class-netserver\"><code>net.Server</code></a>.</p>"
            },
            {
              "textRaw": "`server.setTimeout([msecs][, callback])`",
              "name": "setTimeout",
              "type": "method",
              "meta": {
                "added": [
                  "v0.9.12"
                ],
                "changes": [
                  {
                    "version": "v13.0.0",
                    "pr-url": "https://github.com/nodejs/node/pull/27558",
                    "description": "The default timeout changed from 120s to 0 (no timeout)."
                  }
                ]
              },
              "signatures": [
                {
                  "params": [
                    {
                      "textRaw": "`msecs` {number} **Default:** 0 (no timeout)",
                      "name": "msecs",
                      "type": "number",
                      "default": "0 (no timeout)",
                      "optional": true
                    },
                    {
                      "textRaw": "`callback` {Function}",
                      "name": "callback",
                      "type": "Function",
                      "optional": true
                    }
                  ],
                  "return": {
                    "textRaw": "Returns: {http.Server}",
                    "name": "return",
                    "type": "http.Server"
                  }
                }
              ],
              "desc": "<p>Sets the timeout value for sockets, and emits a <code>'timeout'</code> event on\nthe Server object, passing the socket as an argument, if a timeout\noccurs.</p>\n<p>If there is a <code>'timeout'</code> event listener on the Server object, then it\nwill be called with the timed-out socket as an argument.</p>\n<p>By default, the Server does not timeout sockets. However, if a callback\nis assigned to the Server's <code>'timeout'</code> event, timeouts must be handled\nexplicitly.</p>"
            },
            {
              "textRaw": "`server[Symbol.asyncDispose]()`",
              "name": "[Symbol.asyncDispose]",
              "type": "method",
              "meta": {
                "added": [
                  "v20.4.0"
                ],
                "changes": [
                  {
                    "version": "v24.2.0",
                    "pr-url": "https://github.com/nodejs/node/pull/58467",
                    "description": "No longer experimental."
                  }
                ]
              },
              "signatures": [
                {
                  "params": []
                }
              ],
              "desc": "<p>Calls <a href=\"#serverclosecallback\"><code>server.close()</code></a> and returns a promise that fulfills when the\nserver has closed.</p>"
            }
          ],
          "properties": [
            {
              "textRaw": "Type: {number} **Default:** The minimum between `server.requestTimeout` or `60000`.",
              "name": "headersTimeout",
              "type": "number",
              "meta": {
                "added": [
                  "v11.3.0",
                  "v10.14.0"
                ],
                "changes": [
                  {
                    "version": [
                      "v19.4.0",
                      "v18.14.0"
                    ],
                    "pr-url": "https://github.com/nodejs/node/pull/45778",
                    "description": "The default is now set to the minimum between 60000 (60 seconds) or `requestTimeout`."
                  }
                ]
              },
              "default": "The minimum between `server.requestTimeout` or `60000`",
              "desc": "<p>Limit the amount of time the parser will wait to receive the complete HTTP\nheaders.</p>\n<p>If the timeout expires, the server responds with status 408 without\nforwarding the request to the request listener and then closes the connection.</p>\n<p>It must be set to a non-zero value (e.g. 120 seconds) to protect against\npotential Denial-of-Service attacks in case the server is deployed without a\nreverse proxy in front.</p>"
            },
            {
              "textRaw": "Type: {boolean} Indicates whether or not the server is listening for connections.",
              "name": "listening",
              "type": "boolean",
              "meta": {
                "added": [
                  "v5.7.0"
                ],
                "changes": []
              },
              "desc": "Indicates whether or not the server is listening for connections."
            },
            {
              "textRaw": "Type: {number} **Default:** `2000`",
              "name": "maxHeadersCount",
              "type": "number",
              "meta": {
                "added": [
                  "v0.7.0"
                ],
                "changes": []
              },
              "default": "`2000`",
              "desc": "<p>Limits maximum incoming headers count. If set to 0, no limit will be applied.</p>"
            },
            {
              "textRaw": "Type: {number} **Default:** `300000`",
              "name": "requestTimeout",
              "type": "number",
              "meta": {
                "added": [
                  "v14.11.0"
                ],
                "changes": [
                  {
                    "version": "v18.0.0",
                    "pr-url": "https://github.com/nodejs/node/pull/41263",
                    "description": "The default request timeout changed from no timeout to 300s (5 minutes)."
                  }
                ]
              },
              "default": "`300000`",
              "desc": "<p>Sets the timeout value in milliseconds for receiving the entire request from\nthe client.</p>\n<p>If the timeout expires, the server responds with status 408 without\nforwarding the request to the request listener and then closes the connection.</p>\n<p>It must be set to a non-zero value (e.g. 120 seconds) to protect against\npotential Denial-of-Service attacks in case the server is deployed without a\nreverse proxy in front.</p>"
            },
            {
              "textRaw": "Type: {number} Requests per socket. **Default:** 0 (no limit)",
              "name": "maxRequestsPerSocket",
              "type": "number",
              "meta": {
                "added": [
                  "v16.10.0"
                ],
                "changes": []
              },
              "default": "0 (no limit)",
              "desc": "<p>The maximum number of requests socket can handle\nbefore closing keep alive connection.</p>\n<p>A value of <code>0</code> will disable the limit.</p>\n<p>When the limit is reached it will set the <code>Connection</code> header value to <code>close</code>,\nbut will not actually close the connection, subsequent requests sent\nafter the limit is reached will get <code>503 Service Unavailable</code> as a response.</p>",
              "shortDesc": "Requests per socket."
            },
            {
              "textRaw": "Type: {number} Timeout in milliseconds. **Default:** 0 (no timeout)",
              "name": "timeout",
              "type": "number",
              "meta": {
                "added": [
                  "v0.9.12"
                ],
                "changes": [
                  {
                    "version": "v13.0.0",
                    "pr-url": "https://github.com/nodejs/node/pull/27558",
                    "description": "The default timeout changed from 120s to 0 (no timeout)."
                  }
                ]
              },
              "default": "0 (no timeout)",
              "desc": "<p>The number of milliseconds of inactivity before a socket is presumed\nto have timed out.</p>\n<p>A value of <code>0</code> will disable the timeout behavior on incoming connections.</p>\n<p>The socket timeout logic is set up on connection, so changing this\nvalue only affects new connections to the server, not any existing connections.</p>",
              "shortDesc": "Timeout in milliseconds."
            },
            {
              "textRaw": "Type: {number} Timeout in milliseconds. **Default:** `5000` (5 seconds).",
              "name": "keepAliveTimeout",
              "type": "number",
              "meta": {
                "added": [
                  "v8.0.0"
                ],
                "changes": []
              },
              "default": "`5000` (5 seconds)",
              "desc": "<p>The number of milliseconds of inactivity a server needs to wait for additional\nincoming data, after it has finished writing the last response, before a socket\nwill be destroyed.</p>\n<p>This timeout value is combined with the\n<a href=\"#serverkeepalivetimeoutbuffer\"><code>server.keepAliveTimeoutBuffer</code></a> option to determine the actual socket\ntimeout, calculated as:\nsocketTimeout = keepAliveTimeout + keepAliveTimeoutBuffer\nIf the server receives new data before the keep-alive timeout has fired, it\nwill reset the regular inactivity timeout, i.e., <a href=\"#servertimeout\"><code>server.timeout</code></a>.</p>\n<p>A value of <code>0</code> will disable the keep-alive timeout behavior on incoming\nconnections.\nA value of <code>0</code> makes the HTTP server behave similarly to Node.js versions prior\nto 8.0.0, which did not have a keep-alive timeout.</p>\n<p>The socket timeout logic is set up on connection, so changing this value only\naffects new connections to the server, not any existing connections.</p>",
              "shortDesc": "Timeout in milliseconds."
            },
            {
              "textRaw": "Type: {number} Timeout in milliseconds. **Default:** `1000` (1 second).",
              "name": "keepAliveTimeoutBuffer",
              "type": "number",
              "meta": {
                "added": [
                  "v24.6.0",
                  "v22.19.0"
                ],
                "changes": []
              },
              "default": "`1000` (1 second)",
              "desc": "<p>An additional buffer time added to the\n<a href=\"#serverkeepalivetimeout\"><code>server.keepAliveTimeout</code></a> to extend the internal socket timeout.</p>\n<p>This buffer helps reduce connection reset (<code>ECONNRESET</code>) errors by increasing\nthe socket timeout slightly beyond the advertised keep-alive timeout.</p>\n<p>This option applies only to new incoming connections.</p>",
              "shortDesc": "Timeout in milliseconds."
            }
          ]
        },
        {
          "textRaw": "Class: `http.ServerResponse`",
          "name": "http.ServerResponse",
          "type": "class",
          "meta": {
            "added": [
              "v0.1.17"
            ],
            "changes": []
          },
          "desc": "<ul>\n<li>Extends: <a href=\"http.html#class-httpoutgoingmessage\"><code>&#x3C;http.OutgoingMessage></code></a></li>\n</ul>\n<p>This object is created internally by an HTTP server, not by the user. It is\npassed as the second parameter to the <a href=\"#event-request\"><code>'request'</code></a> event.</p>",
          "events": [
            {
              "textRaw": "Event: `'close'`",
              "name": "close",
              "type": "event",
              "meta": {
                "added": [
                  "v0.6.7"
                ],
                "changes": []
              },
              "params": [],
              "desc": "<p>Indicates that the response is completed, or its underlying connection was\nterminated prematurely (before the response completion).</p>"
            },
            {
              "textRaw": "Event: `'finish'`",
              "name": "finish",
              "type": "event",
              "meta": {
                "added": [
                  "v0.3.6"
                ],
                "changes": []
              },
              "params": [],
              "desc": "<p>Emitted when the response has been sent. More specifically, this event is\nemitted when the last segment of the response headers and body have been\nhanded off to the operating system for transmission over the network. It\ndoes not imply that the client has received anything yet.</p>"
            }
          ],
          "methods": [
            {
              "textRaw": "`response.addTrailers(headers)`",
              "name": "addTrailers",
              "type": "method",
              "meta": {
                "added": [
                  "v0.3.0"
                ],
                "changes": []
              },
              "signatures": [
                {
                  "params": [
                    {
                      "textRaw": "`headers` {Object}",
                      "name": "headers",
                      "type": "Object"
                    }
                  ]
                }
              ],
              "desc": "<p>This method adds HTTP trailing headers (a header but at the end of the\nmessage) to the response.</p>\n<p>Trailers will <strong>only</strong> be emitted if chunked encoding is used for the\nresponse; if it is not (e.g. if the request was HTTP/1.0), they will\nbe silently discarded.</p>\n<p>HTTP requires the <code>Trailer</code> header to be sent in order to\nemit trailers, with a list of the header fields in its value. E.g.,</p>\n<pre><code class=\"language-js\">response.writeHead(200, { 'Content-Type': 'text/plain',\n                          'Trailer': 'Content-MD5' });\nresponse.write(fileData);\nresponse.addTrailers({ 'Content-MD5': '7895bf4b8828b55ceaf47747b4bca667' });\nresponse.end();\n</code></pre>\n<p>Attempting to set a header field name or value that contains invalid characters\nwill result in a <a href=\"errors.html#class-typeerror\"><code>TypeError</code></a> being thrown.</p>"
            },
            {
              "textRaw": "`response.cork()`",
              "name": "cork",
              "type": "method",
              "meta": {
                "added": [
                  "v13.2.0",
                  "v12.16.0"
                ],
                "changes": []
              },
              "signatures": [
                {
                  "params": []
                }
              ],
              "desc": "<p>See <a href=\"stream.html#writablecork\"><code>writable.cork()</code></a>.</p>"
            },
            {
              "textRaw": "`response.end([data[, encoding]][, callback])`",
              "name": "end",
              "type": "method",
              "meta": {
                "added": [
                  "v0.1.90"
                ],
                "changes": [
                  {
                    "version": "v15.0.0",
                    "pr-url": "https://github.com/nodejs/node/pull/33155",
                    "description": "The `data` parameter can now be a `Uint8Array`."
                  },
                  {
                    "version": "v10.0.0",
                    "pr-url": "https://github.com/nodejs/node/pull/18780",
                    "description": "This method now returns a reference to `ServerResponse`."
                  }
                ]
              },
              "signatures": [
                {
                  "params": [
                    {
                      "textRaw": "`data` {string|Buffer|Uint8Array}",
                      "name": "data",
                      "type": "string|Buffer|Uint8Array",
                      "optional": true
                    },
                    {
                      "textRaw": "`encoding` {string}",
                      "name": "encoding",
                      "type": "string",
                      "optional": true
                    },
                    {
                      "textRaw": "`callback` {Function}",
                      "name": "callback",
                      "type": "Function",
                      "optional": true
                    }
                  ],
                  "return": {
                    "textRaw": "Returns: {this}",
                    "name": "return",
                    "type": "this"
                  }
                }
              ],
              "desc": "<p>This method signals to the server that all of the response headers and body\nhave been sent; that server should consider this message complete.\nThe method, <code>response.end()</code>, MUST be called on each response.</p>\n<p>If <code>data</code> is specified, it is similar in effect to calling\n<a href=\"#responsewritechunk-encoding-callback\"><code>response.write(data, encoding)</code></a> followed by <code>response.end(callback)</code>.</p>\n<p>If <code>callback</code> is specified, it will be called when the response stream\nis finished.</p>"
            },
            {
              "textRaw": "`response.flushHeaders()`",
              "name": "flushHeaders",
              "type": "method",
              "meta": {
                "added": [
                  "v1.6.0"
                ],
                "changes": []
              },
              "signatures": [
                {
                  "params": []
                }
              ],
              "desc": "<p>Flushes the response headers. See also: <a href=\"#requestflushheaders\"><code>request.flushHeaders()</code></a>.</p>"
            },
            {
              "textRaw": "`response.getHeader(name)`",
              "name": "getHeader",
              "type": "method",
              "meta": {
                "added": [
                  "v0.4.0"
                ],
                "changes": []
              },
              "signatures": [
                {
                  "params": [
                    {
                      "textRaw": "`name` {string}",
                      "name": "name",
                      "type": "string"
                    }
                  ],
                  "return": {
                    "textRaw": "Returns: {number|string|string}[] | {undefined}",
                    "name": "return",
                    "type": "number|string|string",
                    "desc": "[] | {undefined}"
                  }
                }
              ],
              "desc": "<p>Reads out a header that's already been queued but not sent to the client.\nThe name is case-insensitive. The type of the return value depends\non the arguments provided to <a href=\"#responsesetheadername-value\"><code>response.setHeader()</code></a>.</p>\n<pre><code class=\"language-js\">response.setHeader('Content-Type', 'text/html');\nresponse.setHeader('Content-Length', Buffer.byteLength(body));\nresponse.setHeader('Set-Cookie', ['type=ninja', 'language=javascript']);\nconst contentType = response.getHeader('content-type');\n// contentType is 'text/html'\nconst contentLength = response.getHeader('Content-Length');\n// contentLength is of type number\nconst setCookie = response.getHeader('set-cookie');\n// setCookie is of type string[]\n</code></pre>"
            },
            {
              "textRaw": "`response.getHeaderNames()`",
              "name": "getHeaderNames",
              "type": "method",
              "meta": {
                "added": [
                  "v7.7.0"
                ],
                "changes": []
              },
              "signatures": [
                {
                  "params": [],
                  "return": {
                    "textRaw": "Returns: {string}[]",
                    "name": "return",
                    "type": "string",
                    "desc": "[]"
                  }
                }
              ],
              "desc": "<p>Returns an array containing the unique names of the current outgoing headers.\nAll header names are lowercase.</p>\n<pre><code class=\"language-js\">response.setHeader('Foo', 'bar');\nresponse.setHeader('Set-Cookie', ['foo=bar', 'bar=baz']);\n\nconst headerNames = response.getHeaderNames();\n// headerNames === ['foo', 'set-cookie']\n</code></pre>"
            },
            {
              "textRaw": "`response.getHeaders()`",
              "name": "getHeaders",
              "type": "method",
              "meta": {
                "added": [
                  "v7.7.0"
                ],
                "changes": []
              },
              "signatures": [
                {
                  "params": [],
                  "return": {
                    "textRaw": "Returns: {Object}",
                    "name": "return",
                    "type": "Object"
                  }
                }
              ],
              "desc": "<p>Returns a shallow copy of the current outgoing headers. Since a shallow copy\nis used, array values may be mutated without additional calls to various\nheader-related http module methods. The keys of the returned object are the\nheader names and the values are the respective header values. All header names\nare lowercase.</p>\n<p>The object returned by the <code>response.getHeaders()</code> method <em>does not</em>\nprototypically inherit from the JavaScript <code>Object</code>. This means that typical\n<code>Object</code> methods such as <code>obj.toString()</code>, <code>obj.hasOwnProperty()</code>, and others\nare not defined and <em>will not work</em>.</p>\n<pre><code class=\"language-js\">response.setHeader('Foo', 'bar');\nresponse.setHeader('Set-Cookie', ['foo=bar', 'bar=baz']);\n\nconst headers = response.getHeaders();\n// headers === { foo: 'bar', 'set-cookie': ['foo=bar', 'bar=baz'] }\n</code></pre>"
            },
            {
              "textRaw": "`response.hasHeader(name)`",
              "name": "hasHeader",
              "type": "method",
              "meta": {
                "added": [
                  "v7.7.0"
                ],
                "changes": []
              },
              "signatures": [
                {
                  "params": [
                    {
                      "textRaw": "`name` {string}",
                      "name": "name",
                      "type": "string"
                    }
                  ],
                  "return": {
                    "textRaw": "Returns: {boolean}",
                    "name": "return",
                    "type": "boolean"
                  }
                }
              ],
              "desc": "<p>Returns <code>true</code> if the header identified by <code>name</code> is currently set in the\noutgoing headers. The header name matching is case-insensitive.</p>\n<pre><code class=\"language-js\">const hasContentType = response.hasHeader('content-type');\n</code></pre>"
            },
            {
              "textRaw": "`response.removeHeader(name)`",
              "name": "removeHeader",
              "type": "method",
              "meta": {
                "added": [
                  "v0.4.0"
                ],
                "changes": []
              },
              "signatures": [
                {
                  "params": [
                    {
                      "textRaw": "`name` {string}",
                      "name": "name",
                      "type": "string"
                    }
                  ]
                }
              ],
              "desc": "<p>Removes a header that's queued for implicit sending.</p>\n<pre><code class=\"language-js\">response.removeHeader('Content-Encoding');\n</code></pre>"
            },
            {
              "textRaw": "`response.setHeader(name, value)`",
              "name": "setHeader",
              "type": "method",
              "meta": {
                "added": [
                  "v0.4.0"
                ],
                "changes": []
              },
              "signatures": [
                {
                  "params": [
                    {
                      "textRaw": "`name` {string}",
                      "name": "name",
                      "type": "string"
                    },
                    {
                      "textRaw": "`value` {number|string|string}[]",
                      "name": "value",
                      "type": "number|string|string",
                      "desc": "[]"
                    }
                  ],
                  "return": {
                    "textRaw": "Returns: {http.ServerResponse}",
                    "name": "return",
                    "type": "http.ServerResponse"
                  }
                }
              ],
              "desc": "<p>Returns the response object.</p>\n<p>Sets a single header value for implicit headers. If this header already exists\nin the to-be-sent headers, its value will be replaced. Use an array of strings\nhere to send multiple headers with the same name. Non-string values will be\nstored without modification. Therefore, <a href=\"#responsegetheadername\"><code>response.getHeader()</code></a> may return\nnon-string values. However, the non-string values will be converted to strings\nfor network transmission. The same response object is returned to the caller,\nto enable call chaining.</p>\n<pre><code class=\"language-js\">response.setHeader('Content-Type', 'text/html');\n</code></pre>\n<p>or</p>\n<pre><code class=\"language-js\">response.setHeader('Set-Cookie', ['type=ninja', 'language=javascript']);\n</code></pre>\n<p>Attempting to set a header field name or value that contains invalid characters\nwill result in a <a href=\"errors.html#class-typeerror\"><code>TypeError</code></a> being thrown.</p>\n<p>When headers have been set with <a href=\"#responsesetheadername-value\"><code>response.setHeader()</code></a>, they will be merged\nwith any headers passed to <a href=\"#responsewriteheadstatuscode-statusmessage-headers\"><code>response.writeHead()</code></a>, with the headers passed\nto <a href=\"#responsewriteheadstatuscode-statusmessage-headers\"><code>response.writeHead()</code></a> given precedence.</p>\n<pre><code class=\"language-js\">// Returns content-type = text/plain\nconst server = http.createServer((req, res) => {\n  res.setHeader('Content-Type', 'text/html');\n  res.setHeader('X-Foo', 'bar');\n  res.writeHead(200, { 'Content-Type': 'text/plain' });\n  res.end('ok');\n});\n</code></pre>\n<p>If <a href=\"#responsewriteheadstatuscode-statusmessage-headers\"><code>response.writeHead()</code></a> method is called and this method has not been\ncalled, it will directly write the supplied header values onto the network\nchannel without caching internally, and the <a href=\"#responsegetheadername\"><code>response.getHeader()</code></a> on the\nheader will not yield the expected result. If progressive population of headers\nis desired with potential future retrieval and modification, use\n<a href=\"#responsesetheadername-value\"><code>response.setHeader()</code></a> instead of <a href=\"#responsewriteheadstatuscode-statusmessage-headers\"><code>response.writeHead()</code></a>.</p>"
            },
            {
              "textRaw": "`response.setTimeout(msecs[, callback])`",
              "name": "setTimeout",
              "type": "method",
              "meta": {
                "added": [
                  "v0.9.12"
                ],
                "changes": []
              },
              "signatures": [
                {
                  "params": [
                    {
                      "textRaw": "`msecs` {number}",
                      "name": "msecs",
                      "type": "number"
                    },
                    {
                      "textRaw": "`callback` {Function}",
                      "name": "callback",
                      "type": "Function",
                      "optional": true
                    }
                  ],
                  "return": {
                    "textRaw": "Returns: {http.ServerResponse}",
                    "name": "return",
                    "type": "http.ServerResponse"
                  }
                }
              ],
              "desc": "<p>Sets the Socket's timeout value to <code>msecs</code>. If a callback is\nprovided, then it is added as a listener on the <code>'timeout'</code> event on\nthe response object.</p>\n<p>If no <code>'timeout'</code> listener is added to the request, the response, or\nthe server, then sockets are destroyed when they time out. If a handler is\nassigned to the request, the response, or the server's <code>'timeout'</code> events,\ntimed out sockets must be handled explicitly.</p>"
            },
            {
              "textRaw": "`response.uncork()`",
              "name": "uncork",
              "type": "method",
              "meta": {
                "added": [
                  "v13.2.0",
                  "v12.16.0"
                ],
                "changes": []
              },
              "signatures": [
                {
                  "params": []
                }
              ],
              "desc": "<p>See <a href=\"stream.html#writableuncork\"><code>writable.uncork()</code></a>.</p>"
            },
            {
              "textRaw": "`response.write(chunk[, encoding][, callback])`",
              "name": "write",
              "type": "method",
              "meta": {
                "added": [
                  "v0.1.29"
                ],
                "changes": [
                  {
                    "version": "v15.0.0",
                    "pr-url": "https://github.com/nodejs/node/pull/33155",
                    "description": "The `chunk` parameter can now be a `Uint8Array`."
                  }
                ]
              },
              "signatures": [
                {
                  "params": [
                    {
                      "textRaw": "`chunk` {string|Buffer|Uint8Array}",
                      "name": "chunk",
                      "type": "string|Buffer|Uint8Array"
                    },
                    {
                      "textRaw": "`encoding` {string} **Default:** `'utf8'`",
                      "name": "encoding",
                      "type": "string",
                      "default": "`'utf8'`",
                      "optional": true
                    },
                    {
                      "textRaw": "`callback` {Function}",
                      "name": "callback",
                      "type": "Function",
                      "optional": true
                    }
                  ],
                  "return": {
                    "textRaw": "Returns: {boolean}",
                    "name": "return",
                    "type": "boolean"
                  }
                }
              ],
              "desc": "<p>If this method is called and <a href=\"#responsewriteheadstatuscode-statusmessage-headers\"><code>response.writeHead()</code></a> has not been called,\nit will switch to implicit header mode and flush the implicit headers.</p>\n<p>This sends a chunk of the response body. This method may\nbe called multiple times to provide successive parts of the body.</p>\n<p>If <code>rejectNonStandardBodyWrites</code> is set to true in <code>createServer</code>\nthen writing to the body is not allowed when the request method or response\nstatus do not support content. If an attempt is made to write to the body for a\nHEAD request or as part of a <code>204</code> or <code>304</code>response, a synchronous <code>Error</code>\nwith the code <code>ERR_HTTP_BODY_NOT_ALLOWED</code> is thrown.</p>\n<p><code>chunk</code> can be a string or a buffer. If <code>chunk</code> is a string,\nthe second parameter specifies how to encode it into a byte stream.\n<code>callback</code> will be called when this chunk of data is flushed.</p>\n<p>This is the raw HTTP body and has nothing to do with higher-level multi-part\nbody encodings that may be used.</p>\n<p>The first time <a href=\"#responsewritechunk-encoding-callback\"><code>response.write()</code></a> is called, it will send the buffered\nheader information and the first chunk of the body to the client. The second\ntime <a href=\"#responsewritechunk-encoding-callback\"><code>response.write()</code></a> is called, Node.js assumes data will be streamed,\nand sends the new data separately. That is, the response is buffered up to the\nfirst chunk of the body.</p>\n<p>Returns <code>true</code> if the entire data was flushed successfully to the kernel\nbuffer. Returns <code>false</code> if all or part of the data was queued in user memory.\n<code>'drain'</code> will be emitted when the buffer is free again.</p>"
            },
            {
              "textRaw": "`response.writeContinue()`",
              "name": "writeContinue",
              "type": "method",
              "meta": {
                "added": [
                  "v0.3.0"
                ],
                "changes": []
              },
              "signatures": [
                {
                  "params": []
                }
              ],
              "desc": "<p>Sends an HTTP/1.1 100 Continue message to the client, indicating that\nthe request body should be sent. See the <a href=\"#event-checkcontinue\"><code>'checkContinue'</code></a> event on\n<code>Server</code>.</p>"
            },
            {
              "textRaw": "`response.writeEarlyHints(hints[, callback])`",
              "name": "writeEarlyHints",
              "type": "method",
              "meta": {
                "added": [
                  "v18.11.0"
                ],
                "changes": [
                  {
                    "version": "v18.11.0",
                    "pr-url": "https://github.com/nodejs/node/pull/44820",
                    "description": "Allow passing hints as an object."
                  }
                ]
              },
              "signatures": [
                {
                  "params": [
                    {
                      "textRaw": "`hints` {Object}",
                      "name": "hints",
                      "type": "Object"
                    },
                    {
                      "textRaw": "`callback` {Function}",
                      "name": "callback",
                      "type": "Function",
                      "optional": true
                    }
                  ]
                }
              ],
              "desc": "<p>Sends an HTTP/1.1 103 Early Hints message to the client with a Link header,\nindicating that the user agent can preload/preconnect the linked resources.\nThe <code>hints</code> is an object containing the values of headers to be sent with\nearly hints message. The optional <code>callback</code> argument will be called when\nthe response message has been written.</p>\n<p><strong>Example</strong></p>\n<pre><code class=\"language-js\">const earlyHintsLink = '&#x3C;/styles.css>; rel=preload; as=style';\nresponse.writeEarlyHints({\n  'link': earlyHintsLink,\n});\n\nconst earlyHintsLinks = [\n  '&#x3C;/styles.css>; rel=preload; as=style',\n  '&#x3C;/scripts.js>; rel=preload; as=script',\n];\nresponse.writeEarlyHints({\n  'link': earlyHintsLinks,\n  'x-trace-id': 'id for diagnostics',\n});\n\nconst earlyHintsCallback = () => console.log('early hints message sent');\nresponse.writeEarlyHints({\n  'link': earlyHintsLinks,\n}, earlyHintsCallback);\n</code></pre>"
            },
            {
              "textRaw": "`response.writeHead(statusCode[, statusMessage][, headers])`",
              "name": "writeHead",
              "type": "method",
              "meta": {
                "added": [
                  "v0.1.30"
                ],
                "changes": [
                  {
                    "version": "v14.14.0",
                    "pr-url": "https://github.com/nodejs/node/pull/35274",
                    "description": "Allow passing headers as an array."
                  },
                  {
                    "version": [
                      "v11.10.0",
                      "v10.17.0"
                    ],
                    "pr-url": "https://github.com/nodejs/node/pull/25974",
                    "description": "Return `this` from `writeHead()` to allow chaining with `end()`."
                  },
                  {
                    "version": [
                      "v5.11.0",
                      "v4.4.5"
                    ],
                    "pr-url": "https://github.com/nodejs/node/pull/6291",
                    "description": "A `RangeError` is thrown if `statusCode` is not a number in the range `[100, 999]`."
                  }
                ]
              },
              "signatures": [
                {
                  "params": [
                    {
                      "textRaw": "`statusCode` {number}",
                      "name": "statusCode",
                      "type": "number"
                    },
                    {
                      "textRaw": "`statusMessage` {string}",
                      "name": "statusMessage",
                      "type": "string",
                      "optional": true
                    },
                    {
                      "textRaw": "`headers` {Object|Array}",
                      "name": "headers",
                      "type": "Object|Array",
                      "optional": true
                    }
                  ],
                  "return": {
                    "textRaw": "Returns: {http.ServerResponse}",
                    "name": "return",
                    "type": "http.ServerResponse"
                  }
                }
              ],
              "desc": "<p>Sends a response header to the request. The status code is a 3-digit HTTP\nstatus code, like <code>404</code>. The last argument, <code>headers</code>, are the response headers.\nOptionally one can give a human-readable <code>statusMessage</code> as the second\nargument.</p>\n<p><code>headers</code> may be an <code>Array</code> where the keys and values are in the same list.\nIt is <em>not</em> a list of tuples. So, the even-numbered offsets are key values,\nand the odd-numbered offsets are the associated values. The array is in the same\nformat as <code>request.rawHeaders</code>.</p>\n<p>Returns a reference to the <code>ServerResponse</code>, so that calls can be chained.</p>\n<pre><code class=\"language-js\">const body = 'hello world';\nresponse\n  .writeHead(200, {\n    'Content-Length': Buffer.byteLength(body),\n    'Content-Type': 'text/plain',\n  })\n  .end(body);\n</code></pre>\n<p>This method must only be called once on a message and it must\nbe called before <a href=\"#responseenddata-encoding-callback\"><code>response.end()</code></a> is called.</p>\n<p>If <a href=\"#responsewritechunk-encoding-callback\"><code>response.write()</code></a> or <a href=\"#responseenddata-encoding-callback\"><code>response.end()</code></a> are called before calling\nthis, the implicit/mutable headers will be calculated and call this function.</p>\n<p>When headers have been set with <a href=\"#responsesetheadername-value\"><code>response.setHeader()</code></a>, they will be merged\nwith any headers passed to <a href=\"#responsewriteheadstatuscode-statusmessage-headers\"><code>response.writeHead()</code></a>, with the headers passed\nto <a href=\"#responsewriteheadstatuscode-statusmessage-headers\"><code>response.writeHead()</code></a> given precedence.</p>\n<p>If this method is called and <a href=\"#responsesetheadername-value\"><code>response.setHeader()</code></a> has not been called,\nit will directly write the supplied header values onto the network channel\nwithout caching internally, and the <a href=\"#responsegetheadername\"><code>response.getHeader()</code></a> on the header\nwill not yield the expected result. If progressive population of headers is\ndesired with potential future retrieval and modification, use\n<a href=\"#responsesetheadername-value\"><code>response.setHeader()</code></a> instead.</p>\n<pre><code class=\"language-js\">// Returns content-type = text/plain\nconst server = http.createServer((req, res) => {\n  res.setHeader('Content-Type', 'text/html');\n  res.setHeader('X-Foo', 'bar');\n  res.writeHead(200, { 'Content-Type': 'text/plain' });\n  res.end('ok');\n});\n</code></pre>\n<p><code>Content-Length</code> is read in bytes, not characters. Use\n<a href=\"buffer.html#static-method-bufferbytelengthstring-encoding\"><code>Buffer.byteLength()</code></a> to determine the length of the body in bytes. Node.js\nwill check whether <code>Content-Length</code> and the length of the body which has\nbeen transmitted are equal or not.</p>\n<p>Attempting to set a header field name or value that contains invalid characters\nwill result in a <a href=\"errors.html#class-typeerror\"><code>TypeError</code></a> being thrown.</p>"
            },
            {
              "textRaw": "`response.writeInformation(statusCode[, headers][, callback])`",
              "name": "writeInformation",
              "type": "method",
              "meta": {
                "added": [
                  "v26.2.0"
                ],
                "changes": []
              },
              "signatures": [
                {
                  "params": [
                    {
                      "textRaw": "`statusCode` {number} An HTTP 1xx informational status code, between `100` and `199` inclusive, excluding `101` (Switching Protocols) which is only available through the `'upgrade'` event.",
                      "name": "statusCode",
                      "type": "number",
                      "desc": "An HTTP 1xx informational status code, between `100` and `199` inclusive, excluding `101` (Switching Protocols) which is only available through the `'upgrade'` event."
                    },
                    {
                      "textRaw": "`headers` {Object|Array} An optional set of headers to send with the informational response. Accepts the same shapes as `response.writeHead()`.",
                      "name": "headers",
                      "type": "Object|Array",
                      "desc": "An optional set of headers to send with the informational response. Accepts the same shapes as `response.writeHead()`.",
                      "optional": true
                    },
                    {
                      "textRaw": "`callback` {Function} Optional, called once the message has been written to the socket.",
                      "name": "callback",
                      "type": "Function",
                      "desc": "Optional, called once the message has been written to the socket.",
                      "optional": true
                    }
                  ]
                }
              ],
              "desc": "<p>Sends an arbitrary HTTP/1.1 1xx informational response to the client. This\nis a generic equivalent of <a href=\"#responsewritecontinue\"><code>response.writeContinue()</code></a>,\n<a href=\"#responsewriteprocessing\"><code>response.writeProcessing()</code></a> and <a href=\"#responsewriteearlyhintshints-callback\"><code>response.writeEarlyHints()</code></a>, and\ncan be called multiple times before the final response. After the final\nresponse headers have been sent (via <a href=\"#responsewriteheadstatuscode-statusmessage-headers\"><code>response.writeHead()</code></a> or an\nimplicit header), calling this method throws <code>ERR_HTTP_HEADERS_SENT</code>.</p>\n<p>Clients receive these responses via the <a href=\"#event-information\"><code>'information'</code></a>\nevent on <code>http.ClientRequest</code>.</p>\n<pre><code class=\"language-js\">response.writeInformation(110, { 'X-Progress': '50%' });\n</code></pre>"
            },
            {
              "textRaw": "`response.writeProcessing()`",
              "name": "writeProcessing",
              "type": "method",
              "meta": {
                "added": [
                  "v10.0.0"
                ],
                "changes": []
              },
              "signatures": [
                {
                  "params": []
                }
              ],
              "desc": "<p>Sends an HTTP/1.1 102 Processing message to the client, indicating that\nthe request body should be sent.</p>"
            }
          ],
          "properties": [
            {
              "textRaw": "Type: {stream.Duplex}",
              "name": "connection",
              "type": "stream.Duplex",
              "meta": {
                "added": [
                  "v0.3.0"
                ],
                "changes": [],
                "deprecated": [
                  "v13.0.0"
                ]
              },
              "stability": 0,
              "stabilityText": "Deprecated. Use `response.socket`.",
              "desc": "<p>See <a href=\"#responsesocket\"><code>response.socket</code></a>.</p>"
            },
            {
              "textRaw": "Type: {boolean}",
              "name": "finished",
              "type": "boolean",
              "meta": {
                "added": [
                  "v0.0.2"
                ],
                "changes": [],
                "deprecated": [
                  "v13.4.0",
                  "v12.16.0"
                ]
              },
              "stability": 0,
              "stabilityText": "Deprecated. Use `response.writableEnded`.",
              "desc": "<p>The <code>response.finished</code> property will be <code>true</code> if <a href=\"#responseenddata-encoding-callback\"><code>response.end()</code></a>\nhas been called.</p>"
            },
            {
              "textRaw": "Type: {boolean}",
              "name": "headersSent",
              "type": "boolean",
              "meta": {
                "added": [
                  "v0.9.3"
                ],
                "changes": []
              },
              "desc": "<p>Boolean (read-only). True if headers were sent, false otherwise.</p>"
            },
            {
              "textRaw": "Type: {http.IncomingMessage}",
              "name": "req",
              "type": "http.IncomingMessage",
              "meta": {
                "added": [
                  "v15.7.0"
                ],
                "changes": []
              },
              "desc": "<p>A reference to the original HTTP <code>request</code> object.</p>"
            },
            {
              "textRaw": "Type: {boolean}",
              "name": "sendDate",
              "type": "boolean",
              "meta": {
                "added": [
                  "v0.7.5"
                ],
                "changes": []
              },
              "desc": "<p>When true, the Date header will be automatically generated and sent in\nthe response if it is not already present in the headers. Defaults to true.</p>\n<p>This should only be disabled for testing; the Date header is required in\nmost HTTP responses (see <a href=\"https://www.rfc-editor.org/rfc/rfc9110#section-6.6.1\">RFC 9110 Section 6.6.1</a> for details).</p>"
            },
            {
              "textRaw": "Type: {stream.Duplex}",
              "name": "socket",
              "type": "stream.Duplex",
              "meta": {
                "added": [
                  "v0.3.0"
                ],
                "changes": []
              },
              "desc": "<p>Reference to the underlying socket. Usually users will not want to access\nthis property. In particular, the socket will not emit <code>'readable'</code> events\nbecause of how the protocol parser attaches to the socket. After\n<code>response.end()</code>, the property is nulled.</p>\n<pre><code class=\"language-mjs\">import http from 'node:http';\nconst server = http.createServer((req, res) => {\n  const ip = res.socket.remoteAddress;\n  const port = res.socket.remotePort;\n  res.end(`Your IP address is ${ip} and your source port is ${port}.`);\n}).listen(3000);\n</code></pre>\n<pre><code class=\"language-cjs\">const http = require('node:http');\nconst server = http.createServer((req, res) => {\n  const ip = res.socket.remoteAddress;\n  const port = res.socket.remotePort;\n  res.end(`Your IP address is ${ip} and your source port is ${port}.`);\n}).listen(3000);\n</code></pre>\n<p>This property is guaranteed to be an instance of the <a href=\"net.html#class-netsocket\"><code>&#x3C;net.Socket></code></a> class,\na subclass of <a href=\"stream.html#class-streamduplex\"><code>&#x3C;stream.Duplex></code></a>, unless the user specified a socket\ntype other than <a href=\"net.html#class-netsocket\"><code>&#x3C;net.Socket></code></a>.</p>"
            },
            {
              "textRaw": "Type: {number} **Default:** `200`",
              "name": "statusCode",
              "type": "number",
              "meta": {
                "added": [
                  "v0.4.0"
                ],
                "changes": []
              },
              "default": "`200`",
              "desc": "<p>When using implicit headers (not calling <a href=\"#responsewriteheadstatuscode-statusmessage-headers\"><code>response.writeHead()</code></a> explicitly),\nthis property controls the status code that will be sent to the client when\nthe headers get flushed.</p>\n<pre><code class=\"language-js\">response.statusCode = 404;\n</code></pre>\n<p>After response header was sent to the client, this property indicates the\nstatus code which was sent out.</p>"
            },
            {
              "textRaw": "Type: {string}",
              "name": "statusMessage",
              "type": "string",
              "meta": {
                "added": [
                  "v0.11.8"
                ],
                "changes": []
              },
              "desc": "<p>When using implicit headers (not calling <a href=\"#responsewriteheadstatuscode-statusmessage-headers\"><code>response.writeHead()</code></a> explicitly),\nthis property controls the status message that will be sent to the client when\nthe headers get flushed. If this is left as <code>undefined</code> then the standard\nmessage for the status code will be used.</p>\n<pre><code class=\"language-js\">response.statusMessage = 'Not found';\n</code></pre>\n<p>After response header was sent to the client, this property indicates the\nstatus message which was sent out.</p>"
            },
            {
              "textRaw": "Type: {boolean} **Default:** `false`",
              "name": "strictContentLength",
              "type": "boolean",
              "meta": {
                "added": [
                  "v18.10.0",
                  "v16.18.0"
                ],
                "changes": []
              },
              "default": "`false`",
              "desc": "<p>If set to <code>true</code>, Node.js will check whether the <code>Content-Length</code>\nheader value and the size of the body, in bytes, are equal.\nMismatching the <code>Content-Length</code> header value will result\nin an <code>Error</code> being thrown, identified by <code>code:</code> <a href=\"errors.html#err_http_content_length_mismatch\"><code>'ERR_HTTP_CONTENT_LENGTH_MISMATCH'</code></a>.</p>"
            },
            {
              "textRaw": "Type: {boolean}",
              "name": "writableEnded",
              "type": "boolean",
              "meta": {
                "added": [
                  "v12.9.0"
                ],
                "changes": []
              },
              "desc": "<p>Is <code>true</code> after <a href=\"#responseenddata-encoding-callback\"><code>response.end()</code></a> has been called. This property\ndoes not indicate whether the data has been flushed, for this use\n<a href=\"#responsewritablefinished\"><code>response.writableFinished</code></a> instead.</p>"
            },
            {
              "textRaw": "Type: {boolean}",
              "name": "writableFinished",
              "type": "boolean",
              "meta": {
                "added": [
                  "v12.7.0"
                ],
                "changes": []
              },
              "desc": "<p>Is <code>true</code> if all data has been flushed to the underlying system, immediately\nbefore the <a href=\"#event-finish\"><code>'finish'</code></a> event is emitted.</p>"
            }
          ]
        },
        {
          "textRaw": "Class: `http.IncomingMessage`",
          "name": "http.IncomingMessage",
          "type": "class",
          "meta": {
            "added": [
              "v0.1.17"
            ],
            "changes": [
              {
                "version": "v15.5.0",
                "pr-url": "https://github.com/nodejs/node/pull/33035",
                "description": "The `destroyed` value returns `true` after the incoming data is consumed."
              },
              {
                "version": [
                  "v13.1.0",
                  "v12.16.0"
                ],
                "pr-url": "https://github.com/nodejs/node/pull/30135",
                "description": "The `readableHighWaterMark` value mirrors that of the socket."
              }
            ]
          },
          "desc": "<ul>\n<li>Extends: <a href=\"stream.html#class-streamreadable\"><code>&#x3C;stream.Readable></code></a></li>\n</ul>\n<p>An <code>IncomingMessage</code> object is created by <a href=\"#class-httpserver\"><code>http.Server</code></a> or\n<a href=\"#class-httpclientrequest\"><code>http.ClientRequest</code></a> and passed as the first argument to the <a href=\"#event-request\"><code>'request'</code></a>\nand <a href=\"#event-response\"><code>'response'</code></a> event respectively. It may be used to access response\nstatus, headers, and data.</p>\n<p>Different from its <code>socket</code> value which is a subclass of <a href=\"stream.html#class-streamduplex\"><code>&#x3C;stream.Duplex></code></a>, the <code>IncomingMessage</code> itself extends <a href=\"stream.html#class-streamreadable\"><code>&#x3C;stream.Readable></code></a> and is created separately to\nparse and emit the incoming HTTP headers and payload, as the underlying socket\nmay be reused multiple times in case of keep-alive.</p>",
          "events": [
            {
              "textRaw": "Event: `'aborted'`",
              "name": "aborted",
              "type": "event",
              "meta": {
                "added": [
                  "v0.3.8"
                ],
                "changes": [],
                "deprecated": [
                  "v17.0.0",
                  "v16.12.0"
                ]
              },
              "stability": 0,
              "stabilityText": "Deprecated. Listen for `'close'` event instead.",
              "params": [],
              "desc": "<p>Emitted when the request has been aborted.</p>"
            },
            {
              "textRaw": "Event: `'close'`",
              "name": "close",
              "type": "event",
              "meta": {
                "added": [
                  "v0.4.2"
                ],
                "changes": [
                  {
                    "version": "v16.0.0",
                    "pr-url": "https://github.com/nodejs/node/pull/33035",
                    "description": "The close event is now emitted when the request has been completed and not when the underlying socket is closed."
                  }
                ]
              },
              "params": [],
              "desc": "<p>Emitted when the request has been completed.</p>"
            }
          ],
          "properties": [
            {
              "textRaw": "Type: {boolean}",
              "name": "aborted",
              "type": "boolean",
              "meta": {
                "added": [
                  "v10.1.0"
                ],
                "changes": [],
                "deprecated": [
                  "v17.0.0",
                  "v16.12.0"
                ]
              },
              "stability": 0,
              "stabilityText": "Deprecated. Check `message.destroyed` from {stream.Readable}.",
              "desc": "<p>The <code>message.aborted</code> property will be <code>true</code> if the request has\nbeen aborted.</p>"
            },
            {
              "textRaw": "Type: {boolean}",
              "name": "complete",
              "type": "boolean",
              "meta": {
                "added": [
                  "v0.3.0"
                ],
                "changes": []
              },
              "desc": "<p>The <code>message.complete</code> property will be <code>true</code> if a complete HTTP message has\nbeen received and successfully parsed.</p>\n<p>This property is particularly useful as a means of determining if a client or\nserver fully transmitted a message before a connection was terminated:</p>\n<pre><code class=\"language-js\">const req = http.request({\n  host: '127.0.0.1',\n  port: 8080,\n  method: 'POST',\n}, (res) => {\n  res.resume();\n  res.on('end', () => {\n    if (!res.complete)\n      console.error(\n        'The connection was terminated while the message was still being sent');\n  });\n});\n</code></pre>"
            },
            {
              "textRaw": "`message.connection`",
              "name": "connection",
              "type": "property",
              "meta": {
                "added": [
                  "v0.1.90"
                ],
                "changes": [],
                "deprecated": [
                  "v16.0.0"
                ]
              },
              "stability": 0,
              "stabilityText": "Deprecated. Use `message.socket`.",
              "desc": "<p>Alias for <a href=\"#messagesocket\"><code>message.socket</code></a>.</p>"
            },
            {
              "textRaw": "Type: {Object}",
              "name": "headers",
              "type": "Object",
              "meta": {
                "added": [
                  "v0.1.5"
                ],
                "changes": [
                  {
                    "version": [
                      "v19.5.0",
                      "v18.14.0"
                    ],
                    "pr-url": "https://github.com/nodejs/node/pull/45982",
                    "description": "The `joinDuplicateHeaders` option in the `http.request()` and `http.createServer()` functions ensures that duplicate headers are not discarded, but rather combined using a comma separator, in accordance with RFC 9110 Section 5.3."
                  },
                  {
                    "version": "v15.1.0",
                    "pr-url": "https://github.com/nodejs/node/pull/35281",
                    "description": "`message.headers` is now lazily computed using an accessor property on the prototype and is no longer enumerable."
                  }
                ]
              },
              "desc": "<p>The request/response headers object.</p>\n<p>Key-value pairs of header names and values. Header names are lower-cased.</p>\n<pre><code class=\"language-js\">// Prints something like:\n//\n// { 'user-agent': 'curl/7.22.0',\n//   host: '127.0.0.1:8000',\n//   accept: '*/*' }\nconsole.log(request.headers);\n</code></pre>\n<p>Duplicates in raw headers are handled in the following ways, depending on the\nheader name:</p>\n<ul>\n<li>Duplicates of <code>age</code>, <code>authorization</code>, <code>content-length</code>, <code>content-type</code>,\n<code>etag</code>, <code>expires</code>, <code>from</code>, <code>host</code>, <code>if-modified-since</code>, <code>if-unmodified-since</code>,\n<code>last-modified</code>, <code>location</code>, <code>max-forwards</code>, <code>proxy-authorization</code>, <code>referer</code>,\n<code>retry-after</code>, <code>server</code>, or <code>user-agent</code> are discarded.\nTo allow duplicate values of the headers listed above to be joined,\nuse the option <code>joinDuplicateHeaders</code> in <a href=\"#httprequestoptions-callback\"><code>http.request()</code></a>\nand <a href=\"#httpcreateserveroptions-requestlistener\"><code>http.createServer()</code></a>. See RFC 9110 Section 5.3 for more\ninformation.</li>\n<li><code>set-cookie</code> is always an array. Duplicates are added to the array.</li>\n<li>For duplicate <code>cookie</code> headers, the values are joined together with <code>; </code>.</li>\n<li>For all other headers, the values are joined together with <code>, </code>.</li>\n</ul>"
            },
            {
              "textRaw": "Type: {Object}",
              "name": "headersDistinct",
              "type": "Object",
              "meta": {
                "added": [
                  "v18.3.0",
                  "v16.17.0"
                ],
                "changes": []
              },
              "desc": "<p>Similar to <a href=\"#messageheaders\"><code>message.headers</code></a>, but there is no join logic and the values are\nalways arrays of strings, even for headers received just once.</p>\n<pre><code class=\"language-js\">// Prints something like:\n//\n// { 'user-agent': ['curl/7.22.0'],\n//   host: ['127.0.0.1:8000'],\n//   accept: ['*/*'] }\nconsole.log(request.headersDistinct);\n</code></pre>"
            },
            {
              "textRaw": "Type: {string}",
              "name": "httpVersion",
              "type": "string",
              "meta": {
                "added": [
                  "v0.1.1"
                ],
                "changes": []
              },
              "desc": "<p>In case of server request, the HTTP version sent by the client. In the case of\nclient response, the HTTP version of the connected-to server.\nProbably either <code>'1.1'</code> or <code>'1.0'</code>.</p>\n<p>Also <code>message.httpVersionMajor</code> is the first integer and\n<code>message.httpVersionMinor</code> is the second.</p>"
            },
            {
              "textRaw": "Type: {string}",
              "name": "method",
              "type": "string",
              "meta": {
                "added": [
                  "v0.1.1"
                ],
                "changes": []
              },
              "desc": "<p><strong>Only valid for request obtained from <a href=\"#class-httpserver\"><code>http.Server</code></a>.</strong></p>\n<p>The request method as a string. Read only. Examples: <code>'GET'</code>, <code>'DELETE'</code>.</p>"
            },
            {
              "textRaw": "Type: {string}[]",
              "name": "rawHeaders",
              "type": "string",
              "meta": {
                "added": [
                  "v0.11.6"
                ],
                "changes": []
              },
              "desc": "<p>The raw request/response headers list exactly as they were received.</p>\n<p>The keys and values are in the same list. It is <em>not</em> a\nlist of tuples. So, the even-numbered offsets are key values, and the\nodd-numbered offsets are the associated values.</p>\n<p>Header names are not lowercased, and duplicates are not merged.</p>\n<pre><code class=\"language-js\">// Prints something like:\n//\n// [ 'user-agent',\n//   'this is invalid because there can be only one',\n//   'User-Agent',\n//   'curl/7.22.0',\n//   'Host',\n//   '127.0.0.1:8000',\n//   'ACCEPT',\n//   '*/*' ]\nconsole.log(request.rawHeaders);\n</code></pre>",
              "shortDesc": "[]"
            },
            {
              "textRaw": "Type: {string}[]",
              "name": "rawTrailers",
              "type": "string",
              "meta": {
                "added": [
                  "v0.11.6"
                ],
                "changes": []
              },
              "desc": "<p>The raw request/response trailer keys and values exactly as they were\nreceived. Only populated at the <code>'end'</code> event.</p>",
              "shortDesc": "[]"
            },
            {
              "textRaw": "Type: {AbortSignal}",
              "name": "signal",
              "type": "AbortSignal",
              "meta": {
                "added": [
                  "v26.1.0"
                ],
                "changes": []
              },
              "desc": "<p>An <a href=\"globals.html#class-abortsignal\"><code>&#x3C;AbortSignal></code></a> that is aborted when the underlying socket closes or the\nrequest is destroyed. The signal is created lazily on first access — no\n<a href=\"globals.html#class-abortcontroller\"><code>&#x3C;AbortController></code></a> is allocated for requests that never use this property.</p>\n<p>This is useful for cancelling downstream asynchronous work such as database\nqueries or <code>fetch</code> calls when a client disconnects mid-request.</p>\n<pre><code class=\"language-mjs\">import http from 'node:http';\n\nhttp.createServer(async (req, res) => {\n  try {\n    const data = await fetch('https://example.com/api', { signal: req.signal });\n    res.end(JSON.stringify(await data.json()));\n  } catch (err) {\n    if (err.name === 'AbortError') return;\n    res.statusCode = 500;\n    res.end('Internal Server Error');\n  }\n}).listen(3000);\n</code></pre>\n<pre><code class=\"language-cjs\">const http = require('node:http');\n\nhttp.createServer(async (req, res) => {\n  try {\n    const data = await fetch('https://example.com/api', { signal: req.signal });\n    res.end(JSON.stringify(await data.json()));\n  } catch (err) {\n    if (err.name === 'AbortError') return;\n    res.statusCode = 500;\n    res.end('Internal Server Error');\n  }\n}).listen(3000);\n</code></pre>"
            },
            {
              "textRaw": "Type: {stream.Duplex}",
              "name": "socket",
              "type": "stream.Duplex",
              "meta": {
                "added": [
                  "v0.3.0"
                ],
                "changes": []
              },
              "desc": "<p>The <a href=\"net.html#class-netsocket\"><code>net.Socket</code></a> object associated with the connection.</p>\n<p>With HTTPS support, use <a href=\"tls.html#tlssocketgetpeercertificatedetailed\"><code>request.socket.getPeerCertificate()</code></a> to obtain the\nclient's authentication details.</p>\n<p>This property is guaranteed to be an instance of the <a href=\"net.html#class-netsocket\"><code>&#x3C;net.Socket></code></a> class,\na subclass of <a href=\"stream.html#class-streamduplex\"><code>&#x3C;stream.Duplex></code></a>, unless the user specified a socket\ntype other than <a href=\"net.html#class-netsocket\"><code>&#x3C;net.Socket></code></a> or internally nulled.</p>"
            },
            {
              "textRaw": "Type: {number}",
              "name": "statusCode",
              "type": "number",
              "meta": {
                "added": [
                  "v0.1.1"
                ],
                "changes": []
              },
              "desc": "<p><strong>Only valid for response obtained from <a href=\"#class-httpclientrequest\"><code>http.ClientRequest</code></a>.</strong></p>\n<p>The 3-digit HTTP response status code. E.G. <code>404</code>.</p>"
            },
            {
              "textRaw": "Type: {string}",
              "name": "statusMessage",
              "type": "string",
              "meta": {
                "added": [
                  "v0.11.10"
                ],
                "changes": []
              },
              "desc": "<p><strong>Only valid for response obtained from <a href=\"#class-httpclientrequest\"><code>http.ClientRequest</code></a>.</strong></p>\n<p>The HTTP response status message (reason phrase). E.G. <code>OK</code> or <code>Internal Server Error</code>.</p>"
            },
            {
              "textRaw": "Type: {Object}",
              "name": "trailers",
              "type": "Object",
              "meta": {
                "added": [
                  "v0.3.0"
                ],
                "changes": []
              },
              "desc": "<p>The request/response trailers object. Only populated at the <code>'end'</code> event.</p>"
            },
            {
              "textRaw": "Type: {Object}",
              "name": "trailersDistinct",
              "type": "Object",
              "meta": {
                "added": [
                  "v18.3.0",
                  "v16.17.0"
                ],
                "changes": []
              },
              "desc": "<p>Similar to <a href=\"#messagetrailers\"><code>message.trailers</code></a>, but there is no join logic and the values are\nalways arrays of strings, even for headers received just once.\nOnly populated at the <code>'end'</code> event.</p>"
            },
            {
              "textRaw": "Type: {string}",
              "name": "url",
              "type": "string",
              "meta": {
                "added": [
                  "v0.1.90"
                ],
                "changes": []
              },
              "desc": "<p><strong>Only valid for request obtained from <a href=\"#class-httpserver\"><code>http.Server</code></a>.</strong></p>\n<p>Request URL string. This contains only the URL that is present in the actual\nHTTP request. Take the following request:</p>\n<pre><code class=\"language-http\">GET /status?name=ryan HTTP/1.1\nAccept: text/plain\n</code></pre>\n<p>To parse the URL into its parts:</p>\n<pre><code class=\"language-js\">new URL(`http://${process.env.HOST ?? 'localhost'}${request.url}`);\n</code></pre>\n<p>When <code>request.url</code> is <code>'/status?name=ryan'</code> and <code>process.env.HOST</code> is undefined:</p>\n<pre><code class=\"language-console\">$ node\n> new URL(`http://${process.env.HOST ?? 'localhost'}${request.url}`);\nURL {\n  href: 'http://localhost/status?name=ryan',\n  origin: 'http://localhost',\n  protocol: 'http:',\n  username: '',\n  password: '',\n  host: 'localhost',\n  hostname: 'localhost',\n  port: '',\n  pathname: '/status',\n  search: '?name=ryan',\n  searchParams: URLSearchParams { 'name' => 'ryan' },\n  hash: ''\n}\n</code></pre>\n<p>Ensure that you set <code>process.env.HOST</code> to the server's host name, or consider\nreplacing this part entirely. If using <code>req.headers.host</code>, ensure proper\nvalidation is used, as clients may specify a custom <code>Host</code> header.</p>"
            }
          ],
          "methods": [
            {
              "textRaw": "`message.destroy([error])`",
              "name": "destroy",
              "type": "method",
              "meta": {
                "added": [
                  "v0.3.0"
                ],
                "changes": [
                  {
                    "version": [
                      "v14.5.0",
                      "v12.19.0"
                    ],
                    "pr-url": "https://github.com/nodejs/node/pull/32789",
                    "description": "The function returns `this` for consistency with other Readable streams."
                  }
                ]
              },
              "signatures": [
                {
                  "params": [
                    {
                      "textRaw": "`error` {Error}",
                      "name": "error",
                      "type": "Error",
                      "optional": true
                    }
                  ],
                  "return": {
                    "textRaw": "Returns: {this}",
                    "name": "return",
                    "type": "this"
                  }
                }
              ],
              "desc": "<p>Calls <code>destroy()</code> on the socket that received the <code>IncomingMessage</code>. If <code>error</code>\nis provided, an <code>'error'</code> event is emitted on the socket and <code>error</code> is passed\nas an argument to any listeners on the event.</p>"
            },
            {
              "textRaw": "`message.setTimeout(msecs[, callback])`",
              "name": "setTimeout",
              "type": "method",
              "meta": {
                "added": [
                  "v0.5.9"
                ],
                "changes": []
              },
              "signatures": [
                {
                  "params": [
                    {
                      "textRaw": "`msecs` {number}",
                      "name": "msecs",
                      "type": "number"
                    },
                    {
                      "textRaw": "`callback` {Function}",
                      "name": "callback",
                      "type": "Function",
                      "optional": true
                    }
                  ],
                  "return": {
                    "textRaw": "Returns: {http.IncomingMessage}",
                    "name": "return",
                    "type": "http.IncomingMessage"
                  }
                }
              ],
              "desc": "<p>Calls <code>message.socket.setTimeout(msecs, callback)</code>.</p>"
            }
          ]
        },
        {
          "textRaw": "Class: `http.OutgoingMessage`",
          "name": "http.OutgoingMessage",
          "type": "class",
          "meta": {
            "added": [
              "v0.1.17"
            ],
            "changes": []
          },
          "desc": "<ul>\n<li>Extends: <a href=\"stream.html#stream\"><code>&#x3C;Stream></code></a></li>\n</ul>\n<p>This class serves as the parent class of <a href=\"#class-httpclientrequest\"><code>http.ClientRequest</code></a>\nand <a href=\"#class-httpserverresponse\"><code>http.ServerResponse</code></a>. It is an abstract outgoing message from\nthe perspective of the participants of an HTTP transaction.</p>",
          "events": [
            {
              "textRaw": "Event: `'drain'`",
              "name": "drain",
              "type": "event",
              "meta": {
                "added": [
                  "v0.3.6"
                ],
                "changes": []
              },
              "params": [],
              "desc": "<p>Emitted when the buffer of the message is free again.</p>"
            },
            {
              "textRaw": "Event: `'finish'`",
              "name": "finish",
              "type": "event",
              "meta": {
                "added": [
                  "v0.1.17"
                ],
                "changes": []
              },
              "params": [],
              "desc": "<p>Emitted when the transmission is finished successfully.</p>"
            },
            {
              "textRaw": "Event: `'prefinish'`",
              "name": "prefinish",
              "type": "event",
              "meta": {
                "added": [
                  "v0.11.6"
                ],
                "changes": []
              },
              "params": [],
              "desc": "<p>Emitted after <code>outgoingMessage.end()</code> is called.\nWhen the event is emitted, all data has been processed but not necessarily\ncompletely flushed.</p>"
            }
          ],
          "methods": [
            {
              "textRaw": "`outgoingMessage.addTrailers(headers)`",
              "name": "addTrailers",
              "type": "method",
              "meta": {
                "added": [
                  "v0.3.0"
                ],
                "changes": []
              },
              "signatures": [
                {
                  "params": [
                    {
                      "textRaw": "`headers` {Object}",
                      "name": "headers",
                      "type": "Object"
                    }
                  ]
                }
              ],
              "desc": "<p>Adds HTTP trailers (headers but at the end of the message) to the message.</p>\n<p>Trailers will <strong>only</strong> be emitted if the message is chunked encoded. If not,\nthe trailers will be silently discarded.</p>\n<p>HTTP requires the <code>Trailer</code> header to be sent to emit trailers,\nwith a list of header field names in its value, e.g.</p>\n<pre><code class=\"language-js\">message.writeHead(200, { 'Content-Type': 'text/plain',\n                         'Trailer': 'Content-MD5' });\nmessage.write(fileData);\nmessage.addTrailers({ 'Content-MD5': '7895bf4b8828b55ceaf47747b4bca667' });\nmessage.end();\n</code></pre>\n<p>Attempting to set a header field name or value that contains invalid characters\nwill result in a <code>TypeError</code> being thrown.</p>"
            },
            {
              "textRaw": "`outgoingMessage.appendHeader(name, value)`",
              "name": "appendHeader",
              "type": "method",
              "meta": {
                "added": [
                  "v18.3.0",
                  "v16.17.0"
                ],
                "changes": []
              },
              "signatures": [
                {
                  "params": [
                    {
                      "textRaw": "`name` {string} Header name",
                      "name": "name",
                      "type": "string",
                      "desc": "Header name"
                    },
                    {
                      "textRaw": "`value` {string|string}[] Header value",
                      "name": "value",
                      "type": "string|string",
                      "desc": "[] Header value"
                    }
                  ],
                  "return": {
                    "textRaw": "Returns: {this}",
                    "name": "return",
                    "type": "this"
                  }
                }
              ],
              "desc": "<p>Append a single header value to the header object.</p>\n<p>If the value is an array, this is equivalent to calling this method multiple\ntimes.</p>\n<p>If there were no previous values for the header, this is equivalent to calling\n<a href=\"#outgoingmessagesetheadername-value\"><code>outgoingMessage.setHeader(name, value)</code></a>.</p>\n<p>Depending of the value of <code>options.uniqueHeaders</code> when the client request or the\nserver were created, this will end up in the header being sent multiple times or\na single time with values joined using <code>; </code>.</p>"
            },
            {
              "textRaw": "`outgoingMessage.cork()`",
              "name": "cork",
              "type": "method",
              "meta": {
                "added": [
                  "v13.2.0",
                  "v12.16.0"
                ],
                "changes": []
              },
              "signatures": [
                {
                  "params": []
                }
              ],
              "desc": "<p>See <a href=\"stream.html#writablecork\"><code>writable.cork()</code></a>.</p>"
            },
            {
              "textRaw": "`outgoingMessage.destroy([error])`",
              "name": "destroy",
              "type": "method",
              "meta": {
                "added": [
                  "v0.3.0"
                ],
                "changes": []
              },
              "signatures": [
                {
                  "params": [
                    {
                      "textRaw": "`error` {Error} Optional, an error to emit with `error` event",
                      "name": "error",
                      "type": "Error",
                      "desc": "Optional, an error to emit with `error` event",
                      "optional": true
                    }
                  ],
                  "return": {
                    "textRaw": "Returns: {this}",
                    "name": "return",
                    "type": "this"
                  }
                }
              ],
              "desc": "<p>Destroys the message. Once a socket is associated with the message\nand is connected, that socket will be destroyed as well.</p>"
            },
            {
              "textRaw": "`outgoingMessage.end(chunk[, encoding][, callback])`",
              "name": "end",
              "type": "method",
              "meta": {
                "added": [
                  "v0.1.90"
                ],
                "changes": [
                  {
                    "version": "v15.0.0",
                    "pr-url": "https://github.com/nodejs/node/pull/33155",
                    "description": "The `chunk` parameter can now be a `Uint8Array`."
                  },
                  {
                    "version": "v0.11.6",
                    "description": "add `callback` argument."
                  }
                ]
              },
              "signatures": [
                {
                  "params": [
                    {
                      "textRaw": "`chunk` {string|Buffer|Uint8Array}",
                      "name": "chunk",
                      "type": "string|Buffer|Uint8Array"
                    },
                    {
                      "textRaw": "`encoding` {string} Optional, **Default**: `utf8`",
                      "name": "encoding",
                      "type": "string",
                      "desc": "Optional, **Default**: `utf8`",
                      "optional": true
                    },
                    {
                      "textRaw": "`callback` {Function} Optional",
                      "name": "callback",
                      "type": "Function",
                      "desc": "Optional",
                      "optional": true
                    }
                  ],
                  "return": {
                    "textRaw": "Returns: {this}",
                    "name": "return",
                    "type": "this"
                  }
                }
              ],
              "desc": "<p>Finishes the outgoing message. If any parts of the body are unsent, it will\nflush them to the underlying system. If the message is chunked, it will\nsend the terminating chunk <code>0\\r\\n\\r\\n</code>, and send the trailers (if any).</p>\n<p>If <code>chunk</code> is specified, it is equivalent to calling\n<code>outgoingMessage.write(chunk, encoding)</code>, followed by\n<code>outgoingMessage.end(callback)</code>.</p>\n<p>If <code>callback</code> is provided, it will be called when the message is finished\n(equivalent to a listener of the <code>'finish'</code> event).</p>"
            },
            {
              "textRaw": "`outgoingMessage.flushHeaders()`",
              "name": "flushHeaders",
              "type": "method",
              "meta": {
                "added": [
                  "v1.6.0"
                ],
                "changes": []
              },
              "signatures": [
                {
                  "params": []
                }
              ],
              "desc": "<p>Flushes the message headers.</p>\n<p>For efficiency reason, Node.js normally buffers the message headers\nuntil <code>outgoingMessage.end()</code> is called or the first chunk of message data\nis written. It then tries to pack the headers and data into a single TCP\npacket.</p>\n<p>It is usually desired (it saves a TCP round-trip), but not when the first\ndata is not sent until possibly much later. <code>outgoingMessage.flushHeaders()</code>\nbypasses the optimization and kickstarts the message.</p>"
            },
            {
              "textRaw": "`outgoingMessage.getHeader(name)`",
              "name": "getHeader",
              "type": "method",
              "meta": {
                "added": [
                  "v0.4.0"
                ],
                "changes": []
              },
              "signatures": [
                {
                  "params": [
                    {
                      "textRaw": "`name` {string} Name of header",
                      "name": "name",
                      "type": "string",
                      "desc": "Name of header"
                    }
                  ],
                  "return": {
                    "textRaw": "Returns: {number|string|string}[] | {undefined}",
                    "name": "return",
                    "type": "number|string|string",
                    "desc": "[] | {undefined}"
                  }
                }
              ],
              "desc": "<p>Gets the value of the HTTP header with the given name. If that header is not\nset, the returned value will be <code>undefined</code>.</p>"
            },
            {
              "textRaw": "`outgoingMessage.getHeaderNames()`",
              "name": "getHeaderNames",
              "type": "method",
              "meta": {
                "added": [
                  "v7.7.0"
                ],
                "changes": []
              },
              "signatures": [
                {
                  "params": [],
                  "return": {
                    "textRaw": "Returns: {string}[]",
                    "name": "return",
                    "type": "string",
                    "desc": "[]"
                  }
                }
              ],
              "desc": "<p>Returns an array containing the unique names of the current outgoing headers.\nAll names are lowercase.</p>"
            },
            {
              "textRaw": "`outgoingMessage.getHeaders()`",
              "name": "getHeaders",
              "type": "method",
              "meta": {
                "added": [
                  "v7.7.0"
                ],
                "changes": []
              },
              "signatures": [
                {
                  "params": [],
                  "return": {
                    "textRaw": "Returns: {Object}",
                    "name": "return",
                    "type": "Object"
                  }
                }
              ],
              "desc": "<p>Returns a shallow copy of the current outgoing headers. Since a shallow\ncopy is used, array values may be mutated without additional calls to\nvarious header-related HTTP module methods. The keys of the returned\nobject are the header names and the values are the respective header\nvalues. All header names are lowercase.</p>\n<p>The object returned by the <code>outgoingMessage.getHeaders()</code> method does\nnot prototypically inherit from the JavaScript <code>Object</code>. This means that\ntypical <code>Object</code> methods such as <code>obj.toString()</code>, <code>obj.hasOwnProperty()</code>,\nand others are not defined and will not work.</p>\n<pre><code class=\"language-js\">outgoingMessage.setHeader('Foo', 'bar');\noutgoingMessage.setHeader('Set-Cookie', ['foo=bar', 'bar=baz']);\n\nconst headers = outgoingMessage.getHeaders();\n// headers === { foo: 'bar', 'set-cookie': ['foo=bar', 'bar=baz'] }\n</code></pre>"
            },
            {
              "textRaw": "`outgoingMessage.hasHeader(name)`",
              "name": "hasHeader",
              "type": "method",
              "meta": {
                "added": [
                  "v7.7.0"
                ],
                "changes": []
              },
              "signatures": [
                {
                  "params": [
                    {
                      "textRaw": "`name` {string}",
                      "name": "name",
                      "type": "string"
                    }
                  ],
                  "return": {
                    "textRaw": "Returns: {boolean}",
                    "name": "return",
                    "type": "boolean"
                  }
                }
              ],
              "desc": "<p>Returns <code>true</code> if the header identified by <code>name</code> is currently set in the\noutgoing headers. The header name is case-insensitive.</p>\n<pre><code class=\"language-js\">const hasContentType = outgoingMessage.hasHeader('content-type');\n</code></pre>"
            },
            {
              "textRaw": "`outgoingMessage.pipe()`",
              "name": "pipe",
              "type": "method",
              "meta": {
                "added": [
                  "v9.0.0"
                ],
                "changes": []
              },
              "signatures": [
                {
                  "params": []
                }
              ],
              "desc": "<p>Overrides the <code>stream.pipe()</code> method inherited from the legacy <code>Stream</code> class\nwhich is the parent class of <code>http.OutgoingMessage</code>.</p>\n<p>Calling this method will throw an <code>Error</code> because <code>outgoingMessage</code> is a\nwrite-only stream.</p>"
            },
            {
              "textRaw": "`outgoingMessage.removeHeader(name)`",
              "name": "removeHeader",
              "type": "method",
              "meta": {
                "added": [
                  "v0.4.0"
                ],
                "changes": []
              },
              "signatures": [
                {
                  "params": [
                    {
                      "textRaw": "`name` {string} Header name",
                      "name": "name",
                      "type": "string",
                      "desc": "Header name"
                    }
                  ]
                }
              ],
              "desc": "<p>Removes a header that is queued for implicit sending.</p>\n<pre><code class=\"language-js\">outgoingMessage.removeHeader('Content-Encoding');\n</code></pre>"
            },
            {
              "textRaw": "`outgoingMessage.setHeader(name, value)`",
              "name": "setHeader",
              "type": "method",
              "meta": {
                "added": [
                  "v0.4.0"
                ],
                "changes": []
              },
              "signatures": [
                {
                  "params": [
                    {
                      "textRaw": "`name` {string} Header name",
                      "name": "name",
                      "type": "string",
                      "desc": "Header name"
                    },
                    {
                      "textRaw": "`value` {number|string|string}[] Header value",
                      "name": "value",
                      "type": "number|string|string",
                      "desc": "[] Header value"
                    }
                  ],
                  "return": {
                    "textRaw": "Returns: {this}",
                    "name": "return",
                    "type": "this"
                  }
                }
              ],
              "desc": "<p>Sets a single header value. If the header already exists in the to-be-sent\nheaders, its value will be replaced. Use an array of strings to send multiple\nheaders with the same name.</p>"
            },
            {
              "textRaw": "`outgoingMessage.setHeaders(headers)`",
              "name": "setHeaders",
              "type": "method",
              "meta": {
                "added": [
                  "v19.6.0",
                  "v18.15.0"
                ],
                "changes": []
              },
              "signatures": [
                {
                  "params": [
                    {
                      "textRaw": "`headers` {Headers|Map}",
                      "name": "headers",
                      "type": "Headers|Map"
                    }
                  ],
                  "return": {
                    "textRaw": "Returns: {this}",
                    "name": "return",
                    "type": "this"
                  }
                }
              ],
              "desc": "<p>Sets multiple header values for implicit headers.\n<code>headers</code> must be an instance of <a href=\"globals.html#class-headers\"><code>Headers</code></a> or <code>Map</code>,\nif a header already exists in the to-be-sent headers,\nits value will be replaced.</p>\n<pre><code class=\"language-js\">const headers = new Headers({ foo: 'bar' });\noutgoingMessage.setHeaders(headers);\n</code></pre>\n<p>or</p>\n<pre><code class=\"language-js\">const headers = new Map([['foo', 'bar']]);\noutgoingMessage.setHeaders(headers);\n</code></pre>\n<p>When headers have been set with <a href=\"#outgoingmessagesetheadersheaders\"><code>outgoingMessage.setHeaders()</code></a>,\nthey will be merged with any headers passed to <a href=\"#responsewriteheadstatuscode-statusmessage-headers\"><code>response.writeHead()</code></a>,\nwith the headers passed to <a href=\"#responsewriteheadstatuscode-statusmessage-headers\"><code>response.writeHead()</code></a> given precedence.</p>\n<pre><code class=\"language-js\">// Returns content-type = text/plain\nconst server = http.createServer((req, res) => {\n  const headers = new Headers({ 'Content-Type': 'text/html' });\n  res.setHeaders(headers);\n  res.writeHead(200, { 'Content-Type': 'text/plain' });\n  res.end('ok');\n});\n</code></pre>"
            },
            {
              "textRaw": "`outgoingMessage.setTimeout(msecs[, callback])`",
              "name": "setTimeout",
              "type": "method",
              "meta": {
                "added": [
                  "v0.9.12"
                ],
                "changes": []
              },
              "signatures": [
                {
                  "params": [
                    {
                      "textRaw": "`msecs` {number}",
                      "name": "msecs",
                      "type": "number"
                    },
                    {
                      "textRaw": "`callback` {Function} Optional function to be called when a timeout occurs. Same as binding to the `timeout` event.",
                      "name": "callback",
                      "type": "Function",
                      "desc": "Optional function to be called when a timeout occurs. Same as binding to the `timeout` event.",
                      "optional": true
                    }
                  ],
                  "return": {
                    "textRaw": "Returns: {this}",
                    "name": "return",
                    "type": "this"
                  }
                }
              ],
              "desc": "<p>Once a socket is associated with the message and is connected,\n<a href=\"net.html#socketsettimeouttimeout-callback\"><code>socket.setTimeout()</code></a> will be called with <code>msecs</code> as the first parameter.</p>"
            },
            {
              "textRaw": "`outgoingMessage.uncork()`",
              "name": "uncork",
              "type": "method",
              "meta": {
                "added": [
                  "v13.2.0",
                  "v12.16.0"
                ],
                "changes": []
              },
              "signatures": [
                {
                  "params": []
                }
              ],
              "desc": "<p>See <a href=\"stream.html#writableuncork\"><code>writable.uncork()</code></a></p>"
            },
            {
              "textRaw": "`outgoingMessage.write(chunk[, encoding][, callback])`",
              "name": "write",
              "type": "method",
              "meta": {
                "added": [
                  "v0.1.29"
                ],
                "changes": [
                  {
                    "version": "v15.0.0",
                    "pr-url": "https://github.com/nodejs/node/pull/33155",
                    "description": "The `chunk` parameter can now be a `Uint8Array`."
                  },
                  {
                    "version": "v0.11.6",
                    "description": "The `callback` argument was added."
                  }
                ]
              },
              "signatures": [
                {
                  "params": [
                    {
                      "textRaw": "`chunk` {string|Buffer|Uint8Array}",
                      "name": "chunk",
                      "type": "string|Buffer|Uint8Array"
                    },
                    {
                      "textRaw": "`encoding` {string} **Default**: `utf8`",
                      "name": "encoding",
                      "type": "string",
                      "desc": "**Default**: `utf8`",
                      "optional": true
                    },
                    {
                      "textRaw": "`callback` {Function}",
                      "name": "callback",
                      "type": "Function",
                      "optional": true
                    }
                  ],
                  "return": {
                    "textRaw": "Returns: {boolean}",
                    "name": "return",
                    "type": "boolean"
                  }
                }
              ],
              "desc": "<p>Sends a chunk of the body. This method can be called multiple times.</p>\n<p>The <code>encoding</code> argument is only relevant when <code>chunk</code> is a string. Defaults to\n<code>'utf8'</code>.</p>\n<p>The <code>callback</code> argument is optional and will be called when this chunk of data\nis flushed.</p>\n<p>Returns <code>true</code> if the entire data was flushed successfully to the kernel\nbuffer. Returns <code>false</code> if all or part of the data was queued in the user\nmemory. The <code>'drain'</code> event will be emitted when the buffer is free again.</p>"
            }
          ],
          "properties": [
            {
              "textRaw": "`outgoingMessage.connection`",
              "name": "connection",
              "type": "property",
              "meta": {
                "added": [
                  "v0.3.0"
                ],
                "changes": [],
                "deprecated": [
                  "v15.12.0",
                  "v14.17.1"
                ]
              },
              "stability": 0,
              "stabilityText": "Deprecated: Use `outgoingMessage.socket` instead.",
              "desc": "<p>Alias of <a href=\"#outgoingmessagesocket\"><code>outgoingMessage.socket</code></a>.</p>"
            },
            {
              "textRaw": "Type: {boolean}",
              "name": "headersSent",
              "type": "boolean",
              "meta": {
                "added": [
                  "v0.9.3"
                ],
                "changes": []
              },
              "desc": "<p>Read-only. <code>true</code> if the headers were sent, otherwise <code>false</code>.</p>"
            },
            {
              "textRaw": "Type: {stream.Duplex}",
              "name": "socket",
              "type": "stream.Duplex",
              "meta": {
                "added": [
                  "v0.3.0"
                ],
                "changes": []
              },
              "desc": "<p>Reference to the underlying socket. Usually, users will not want to access\nthis property.</p>\n<p>After calling <code>outgoingMessage.end()</code>, this property will be nulled.</p>"
            },
            {
              "textRaw": "Type: {number}",
              "name": "writableCorked",
              "type": "number",
              "meta": {
                "added": [
                  "v13.2.0",
                  "v12.16.0"
                ],
                "changes": []
              },
              "desc": "<p>The number of times <code>outgoingMessage.cork()</code> has been called.</p>"
            },
            {
              "textRaw": "Type: {boolean}",
              "name": "writableEnded",
              "type": "boolean",
              "meta": {
                "added": [
                  "v12.9.0"
                ],
                "changes": []
              },
              "desc": "<p>Is <code>true</code> if <code>outgoingMessage.end()</code> has been called. This property does\nnot indicate whether the data has been flushed. For that purpose, use\n<code>message.writableFinished</code> instead.</p>"
            },
            {
              "textRaw": "Type: {boolean}",
              "name": "writableFinished",
              "type": "boolean",
              "meta": {
                "added": [
                  "v12.7.0"
                ],
                "changes": []
              },
              "desc": "<p>Is <code>true</code> if all data has been flushed to the underlying system.</p>"
            },
            {
              "textRaw": "Type: {number}",
              "name": "writableHighWaterMark",
              "type": "number",
              "meta": {
                "added": [
                  "v12.9.0"
                ],
                "changes": []
              },
              "desc": "<p>The <code>highWaterMark</code> of the underlying socket if assigned. Otherwise, the default\nbuffer level when <a href=\"stream.html#writablewritechunk-encoding-callback\"><code>writable.write()</code></a> starts returning false (<code>16384</code>).</p>"
            },
            {
              "textRaw": "Type: {number}",
              "name": "writableLength",
              "type": "number",
              "meta": {
                "added": [
                  "v12.9.0"
                ],
                "changes": []
              },
              "desc": "<p>The number of buffered bytes.</p>"
            },
            {
              "textRaw": "Type: {boolean}",
              "name": "writableObjectMode",
              "type": "boolean",
              "meta": {
                "added": [
                  "v12.9.0"
                ],
                "changes": []
              },
              "desc": "<p>Always <code>false</code>.</p>"
            }
          ]
        },
        {
          "textRaw": "Class: `WebSocket`",
          "name": "WebSocket",
          "type": "class",
          "meta": {
            "added": [
              "v22.5.0"
            ],
            "changes": []
          },
          "desc": "<p>A browser-compatible implementation of <a href=\"https://developer.mozilla.org/docs/Web/API/WebSocket\"><code>&#x3C;WebSocket></code></a>.</p>"
        }
      ],
      "properties": [
        {
          "textRaw": "Type: {string}[]",
          "name": "METHODS",
          "type": "string",
          "meta": {
            "added": [
              "v0.11.8"
            ],
            "changes": []
          },
          "desc": "<p>A list of the HTTP methods that are supported by the parser.</p>",
          "shortDesc": "[]"
        },
        {
          "textRaw": "Type: {Object}",
          "name": "STATUS_CODES",
          "type": "Object",
          "meta": {
            "added": [
              "v0.1.22"
            ],
            "changes": []
          },
          "desc": "<p>A collection of all the standard HTTP response status codes, and the\nshort description of each. For example, <code>http.STATUS_CODES[404] === 'Not Found'</code>.</p>"
        },
        {
          "textRaw": "Type: {http.Agent}",
          "name": "globalAgent",
          "type": "http.Agent",
          "meta": {
            "added": [
              "v0.5.9"
            ],
            "changes": [
              {
                "version": [
                  "v19.0.0"
                ],
                "pr-url": "https://github.com/nodejs/node/pull/43522",
                "description": "The agent now uses HTTP Keep-Alive and a 5 second timeout by default."
              }
            ]
          },
          "desc": "<p>Global instance of <code>Agent</code> which is used as the default for all HTTP client\nrequests. Diverges from a default <code>Agent</code> configuration by having <code>keepAlive</code>\nenabled and a <code>timeout</code> of 5 seconds.</p>"
        },
        {
          "textRaw": "Type: {number}",
          "name": "maxHeaderSize",
          "type": "number",
          "meta": {
            "added": [
              "v11.6.0",
              "v10.15.0"
            ],
            "changes": []
          },
          "desc": "<p>Read-only property specifying the maximum allowed size of HTTP headers in bytes.\nDefaults to 16 KiB. Configurable using the <a href=\"cli.html#--max-http-header-sizesize\"><code>--max-http-header-size</code></a> CLI\noption.</p>\n<p>This can be overridden for servers and client requests by passing the\n<code>maxHeaderSize</code> option.</p>"
        }
      ],
      "methods": [
        {
          "textRaw": "`http.createServer([options][, requestListener])`",
          "name": "createServer",
          "type": "method",
          "meta": {
            "added": [
              "v0.1.13"
            ],
            "changes": [
              {
                "version": "v26.3.0",
                "pr-url": "https://github.com/nodejs/node/pull/61597",
                "description": "The `httpValidation` option is supported now."
              },
              {
                "version": [
                  "v25.1.0",
                  "v24.12.0"
                ],
                "pr-url": "https://github.com/nodejs/node/pull/59778",
                "description": "Add optimizeEmptyRequests option."
              },
              {
                "version": [
                  "v24.9.0",
                  "v22.21.0"
                ],
                "pr-url": "https://github.com/nodejs/node/pull/59824",
                "description": "The `shouldUpgradeCallback` option is now supported."
              },
              {
                "version": [
                  "v20.1.0",
                  "v18.17.0"
                ],
                "pr-url": "https://github.com/nodejs/node/pull/47405",
                "description": "The `highWaterMark` option is supported now."
              },
              {
                "version": "v18.0.0",
                "pr-url": "https://github.com/nodejs/node/pull/41263",
                "description": "The `requestTimeout`, `headersTimeout`, `keepAliveTimeout`, and `connectionsCheckingInterval` options are supported now."
              },
              {
                "version": "v18.0.0",
                "pr-url": "https://github.com/nodejs/node/pull/42163",
                "description": "The `noDelay` option now defaults to `true`."
              },
              {
                "version": [
                  "v17.7.0",
                  "v16.15.0"
                ],
                "pr-url": "https://github.com/nodejs/node/pull/41310",
                "description": "The `noDelay`, `keepAlive` and `keepAliveInitialDelay` options are supported now."
              },
              {
                "version": [
                  "v13.8.0",
                  "v12.15.0",
                  "v10.19.0"
                ],
                "pr-url": "https://github.com/nodejs/node/pull/31448",
                "description": "The `insecureHTTPParser` option is supported now."
              },
              {
                "version": "v13.3.0",
                "pr-url": "https://github.com/nodejs/node/pull/30570",
                "description": "The `maxHeaderSize` option is supported now."
              },
              {
                "version": [
                  "v9.6.0",
                  "v8.12.0"
                ],
                "pr-url": "https://github.com/nodejs/node/pull/15752",
                "description": "The `options` argument is supported now."
              }
            ]
          },
          "signatures": [
            {
              "params": [
                {
                  "textRaw": "`options` {Object}",
                  "name": "options",
                  "type": "Object",
                  "options": [
                    {
                      "textRaw": "`connectionsCheckingInterval`: Sets the interval value in milliseconds to check for request and headers timeout in incomplete requests. **Default:** `30000`.",
                      "name": "connectionsCheckingInterval",
                      "default": "`30000`",
                      "desc": "Sets the interval value in milliseconds to check for request and headers timeout in incomplete requests."
                    },
                    {
                      "textRaw": "`headersTimeout`: Sets the timeout value in milliseconds for receiving the complete HTTP headers from the client. See `server.headersTimeout` for more information. **Default:** `60000`.",
                      "name": "headersTimeout",
                      "default": "`60000`",
                      "desc": "Sets the timeout value in milliseconds for receiving the complete HTTP headers from the client. See `server.headersTimeout` for more information."
                    },
                    {
                      "textRaw": "`highWaterMark` {number} Optionally overrides all `socket`s' `readableHighWaterMark` and `writableHighWaterMark`. This affects `highWaterMark` property of both `IncomingMessage` and `ServerResponse`. **Default:** See `stream.getDefaultHighWaterMark()`.",
                      "name": "highWaterMark",
                      "type": "number",
                      "default": "See `stream.getDefaultHighWaterMark()`",
                      "desc": "Optionally overrides all `socket`s' `readableHighWaterMark` and `writableHighWaterMark`. This affects `highWaterMark` property of both `IncomingMessage` and `ServerResponse`."
                    },
                    {
                      "textRaw": "`httpValidation` {string} Controls HTTP header value validation strictness for incoming requests. Accepted values are:",
                      "name": "httpValidation",
                      "type": "string",
                      "desc": "Controls HTTP header value validation strictness for incoming requests. Accepted values are:",
                      "options": [
                        {
                          "textRaw": "`'strict'`: Strictest validation; rejects any non-ASCII or control characters in header values.",
                          "desc": "`'strict'`: Strictest validation; rejects any non-ASCII or control characters in header values."
                        },
                        {
                          "textRaw": "`'relaxed'`: Allows a limited set of non-ASCII characters in header values, aligning with the Fetch specification.",
                          "desc": "`'relaxed'`: Allows a limited set of non-ASCII characters in header values, aligning with the Fetch specification."
                        },
                        {
                          "textRaw": "`'insecure'`: Disables all header value validation (equivalent to `insecureHTTPParser: true`). Cannot be used together with `insecureHTTPParser`. **Default:** `'strict'`.",
                          "default": "`'strict'`",
                          "desc": "`'insecure'`: Disables all header value validation (equivalent to `insecureHTTPParser: true`). Cannot be used together with `insecureHTTPParser`."
                        }
                      ]
                    },
                    {
                      "textRaw": "`insecureHTTPParser` {boolean} If set to `true`, it will use an HTTP parser with leniency flags enabled. Using the insecure parser should be avoided. See `--insecure-http-parser` for more information. **Default:** `false`.",
                      "name": "insecureHTTPParser",
                      "type": "boolean",
                      "default": "`false`",
                      "desc": "If set to `true`, it will use an HTTP parser with leniency flags enabled. Using the insecure parser should be avoided. See `--insecure-http-parser` for more information."
                    },
                    {
                      "textRaw": "`IncomingMessage` {http.IncomingMessage} Specifies the `IncomingMessage` class to be used. Useful for extending the original `IncomingMessage`. **Default:** `IncomingMessage`.",
                      "name": "IncomingMessage",
                      "type": "http.IncomingMessage",
                      "default": "`IncomingMessage`",
                      "desc": "Specifies the `IncomingMessage` class to be used. Useful for extending the original `IncomingMessage`."
                    },
                    {
                      "textRaw": "`joinDuplicateHeaders` {boolean} If set to `true`, this option allows joining the field line values of multiple headers in a request with a comma (`, `) instead of discarding the duplicates. For more information, refer to `message.headers`. **Default:** `false`.",
                      "name": "joinDuplicateHeaders",
                      "type": "boolean",
                      "default": "`false`",
                      "desc": "If set to `true`, this option allows joining the field line values of multiple headers in a request with a comma (`, `) instead of discarding the duplicates. For more information, refer to `message.headers`."
                    },
                    {
                      "textRaw": "`keepAlive` {boolean} If set to `true`, it enables keep-alive functionality on the socket immediately after a new incoming connection is received, similarly on what is done in `socket.setKeepAlive()`. **Default:** `false`.",
                      "name": "keepAlive",
                      "type": "boolean",
                      "default": "`false`",
                      "desc": "If set to `true`, it enables keep-alive functionality on the socket immediately after a new incoming connection is received, similarly on what is done in `socket.setKeepAlive()`."
                    },
                    {
                      "textRaw": "`keepAliveInitialDelay` {number} If set to a positive number, it sets the initial delay before the first keepalive probe is sent on an idle socket. **Default:** `0`.",
                      "name": "keepAliveInitialDelay",
                      "type": "number",
                      "default": "`0`",
                      "desc": "If set to a positive number, it sets the initial delay before the first keepalive probe is sent on an idle socket."
                    },
                    {
                      "textRaw": "`keepAliveTimeout`: The number of milliseconds of inactivity a server needs to wait for additional incoming data, after it has finished writing the last response, before a socket will be destroyed. See `server.keepAliveTimeout` for more information. **Default:** `5000`.",
                      "name": "keepAliveTimeout",
                      "default": "`5000`",
                      "desc": "The number of milliseconds of inactivity a server needs to wait for additional incoming data, after it has finished writing the last response, before a socket will be destroyed. See `server.keepAliveTimeout` for more information."
                    },
                    {
                      "textRaw": "`maxHeaderSize` {number} Optionally overrides the value of `--max-http-header-size` for requests received by this server, i.e. the maximum length of request headers in bytes. **Default:** 16384 (16 KiB).",
                      "name": "maxHeaderSize",
                      "type": "number",
                      "default": "16384 (16 KiB)",
                      "desc": "Optionally overrides the value of `--max-http-header-size` for requests received by this server, i.e. the maximum length of request headers in bytes."
                    },
                    {
                      "textRaw": "`noDelay` {boolean} If set to `true`, it disables the use of Nagle's algorithm immediately after a new incoming connection is received. **Default:** `true`.",
                      "name": "noDelay",
                      "type": "boolean",
                      "default": "`true`",
                      "desc": "If set to `true`, it disables the use of Nagle's algorithm immediately after a new incoming connection is received."
                    },
                    {
                      "textRaw": "`requestTimeout`: Sets the timeout value in milliseconds for receiving the entire request from the client. See `server.requestTimeout` for more information. **Default:** `300000`.",
                      "name": "requestTimeout",
                      "default": "`300000`",
                      "desc": "Sets the timeout value in milliseconds for receiving the entire request from the client. See `server.requestTimeout` for more information."
                    },
                    {
                      "textRaw": "`requireHostHeader` {boolean} If set to `true`, it forces the server to respond with a 400 (Bad Request) status code to any HTTP/1.1 request message that lacks a Host header (as mandated by the specification). **Default:** `true`.",
                      "name": "requireHostHeader",
                      "type": "boolean",
                      "default": "`true`",
                      "desc": "If set to `true`, it forces the server to respond with a 400 (Bad Request) status code to any HTTP/1.1 request message that lacks a Host header (as mandated by the specification)."
                    },
                    {
                      "textRaw": "`ServerResponse` {http.ServerResponse} Specifies the `ServerResponse` class to be used. Useful for extending the original `ServerResponse`. **Default:** `ServerResponse`.",
                      "name": "ServerResponse",
                      "type": "http.ServerResponse",
                      "default": "`ServerResponse`",
                      "desc": "Specifies the `ServerResponse` class to be used. Useful for extending the original `ServerResponse`."
                    },
                    {
                      "textRaw": "`shouldUpgradeCallback(request)` {Function} A callback which receives an incoming request and returns a boolean, to control which upgrade attempts should be accepted. Accepted upgrades will fire an `'upgrade'` event (or their sockets will be destroyed, if no listener is registered) while rejected upgrades will fire a `'request'` event like any non-upgrade request. This options defaults to `() => server.listenerCount('upgrade') > 0`.",
                      "name": "shouldUpgradeCallback(request)",
                      "type": "Function",
                      "desc": "A callback which receives an incoming request and returns a boolean, to control which upgrade attempts should be accepted. Accepted upgrades will fire an `'upgrade'` event (or their sockets will be destroyed, if no listener is registered) while rejected upgrades will fire a `'request'` event like any non-upgrade request. This options defaults to `() => server.listenerCount('upgrade') > 0`."
                    },
                    {
                      "textRaw": "`uniqueHeaders` {Array} A list of response headers that should be sent only once. If the header's value is an array, the items will be joined using `; `.",
                      "name": "uniqueHeaders",
                      "type": "Array",
                      "desc": "A list of response headers that should be sent only once. If the header's value is an array, the items will be joined using `; `."
                    },
                    {
                      "textRaw": "`rejectNonStandardBodyWrites` {boolean} If set to `true`, an error is thrown when writing to an HTTP response which does not have a body. **Default:** `false`.",
                      "name": "rejectNonStandardBodyWrites",
                      "type": "boolean",
                      "default": "`false`",
                      "desc": "If set to `true`, an error is thrown when writing to an HTTP response which does not have a body."
                    },
                    {
                      "textRaw": "`optimizeEmptyRequests` {boolean} If set to `true`, requests without `Content-Length` or `Transfer-Encoding` headers (indicating no body) will be initialized with an already-ended body stream, so they will never emit any stream events (like `'data'` or `'end'`). You can use `req.readableEnded` to detect this case. **Default:** `false`.",
                      "name": "optimizeEmptyRequests",
                      "type": "boolean",
                      "default": "`false`",
                      "desc": "If set to `true`, requests without `Content-Length` or `Transfer-Encoding` headers (indicating no body) will be initialized with an already-ended body stream, so they will never emit any stream events (like `'data'` or `'end'`). You can use `req.readableEnded` to detect this case."
                    }
                  ],
                  "optional": true
                },
                {
                  "textRaw": "`requestListener` {Function}",
                  "name": "requestListener",
                  "type": "Function",
                  "optional": true
                }
              ],
              "return": {
                "textRaw": "Returns: {http.Server}",
                "name": "return",
                "type": "http.Server"
              }
            }
          ],
          "desc": "<p>Returns a new instance of <a href=\"#class-httpserver\"><code>http.Server</code></a>.</p>\n<p>The <code>requestListener</code> is a function which is automatically\nadded to the <a href=\"#event-request\"><code>'request'</code></a> event.</p>\n<pre><code class=\"language-mjs\">import http from 'node:http';\n\n// Create a local server to receive data from\nconst server = http.createServer((req, res) => {\n  res.writeHead(200, { 'Content-Type': 'application/json' });\n  res.end(JSON.stringify({\n    data: 'Hello World!',\n  }));\n});\n\nserver.listen(8000);\n</code></pre>\n<pre><code class=\"language-cjs\">const http = require('node:http');\n\n// Create a local server to receive data from\nconst server = http.createServer((req, res) => {\n  res.writeHead(200, { 'Content-Type': 'application/json' });\n  res.end(JSON.stringify({\n    data: 'Hello World!',\n  }));\n});\n\nserver.listen(8000);\n</code></pre>\n<pre><code class=\"language-mjs\">import http from 'node:http';\n\n// Create a local server to receive data from\nconst server = http.createServer();\n\n// Listen to the request event\nserver.on('request', (request, res) => {\n  res.writeHead(200, { 'Content-Type': 'application/json' });\n  res.end(JSON.stringify({\n    data: 'Hello World!',\n  }));\n});\n\nserver.listen(8000);\n</code></pre>\n<pre><code class=\"language-cjs\">const http = require('node:http');\n\n// Create a local server to receive data from\nconst server = http.createServer();\n\n// Listen to the request event\nserver.on('request', (request, res) => {\n  res.writeHead(200, { 'Content-Type': 'application/json' });\n  res.end(JSON.stringify({\n    data: 'Hello World!',\n  }));\n});\n\nserver.listen(8000);\n</code></pre>"
        },
        {
          "textRaw": "`http.get(options[, callback])`",
          "name": "get",
          "type": "method",
          "signatures": [
            {
              "params": [
                {
                  "name": "options"
                },
                {
                  "name": "callback",
                  "optional": true
                }
              ]
            }
          ]
        },
        {
          "textRaw": "`http.get(url[, options][, callback])`",
          "name": "get",
          "type": "method",
          "meta": {
            "added": [
              "v0.3.6"
            ],
            "changes": [
              {
                "version": "v10.9.0",
                "pr-url": "https://github.com/nodejs/node/pull/21616",
                "description": "The `url` parameter can now be passed along with a separate `options` object."
              },
              {
                "version": "v7.5.0",
                "pr-url": "https://github.com/nodejs/node/pull/10638",
                "description": "The `options` parameter can be a WHATWG `URL` object."
              }
            ]
          },
          "signatures": [
            {
              "params": [
                {
                  "textRaw": "`url` {string|URL}",
                  "name": "url",
                  "type": "string|URL"
                },
                {
                  "textRaw": "`options` {Object} Accepts the same `options` as `http.request()`, with the method set to GET by default.",
                  "name": "options",
                  "type": "Object",
                  "desc": "Accepts the same `options` as `http.request()`, with the method set to GET by default.",
                  "optional": true
                },
                {
                  "textRaw": "`callback` {Function}",
                  "name": "callback",
                  "type": "Function",
                  "optional": true
                }
              ],
              "return": {
                "textRaw": "Returns: {http.ClientRequest}",
                "name": "return",
                "type": "http.ClientRequest"
              }
            }
          ],
          "desc": "<p>Since most requests are GET requests without bodies, Node.js provides this\nconvenience method. The only difference between this method and\n<a href=\"#httprequestoptions-callback\"><code>http.request()</code></a> is that it sets the method to GET by default and calls <code>req.end()</code>\nautomatically. The callback must take care to consume the response\ndata for reasons stated in <a href=\"#class-httpclientrequest\"><code>http.ClientRequest</code></a> section.</p>\n<p>The <code>callback</code> is invoked with a single argument that is an instance of\n<a href=\"#class-httpincomingmessage\"><code>http.IncomingMessage</code></a>.</p>\n<p>JSON fetching example:</p>\n<pre><code class=\"language-js\">http.get('http://localhost:8000/', (res) => {\n  const { statusCode } = res;\n  const contentType = res.headers['content-type'];\n\n  let error;\n  // Any 2xx status code signals a successful response but\n  // here we're only checking for 200.\n  if (statusCode !== 200) {\n    error = new Error('Request Failed.\\n' +\n                      `Status Code: ${statusCode}`);\n  } else if (!/^application\\/json/.test(contentType)) {\n    error = new Error('Invalid content-type.\\n' +\n                      `Expected application/json but received ${contentType}`);\n  }\n  if (error) {\n    console.error(error.message);\n    // Consume response data to free up memory\n    res.resume();\n    return;\n  }\n\n  res.setEncoding('utf8');\n  let rawData = '';\n  res.on('data', (chunk) => { rawData += chunk; });\n  res.on('end', () => {\n    try {\n      const parsedData = JSON.parse(rawData);\n      console.log(parsedData);\n    } catch (e) {\n      console.error(e.message);\n    }\n  });\n}).on('error', (e) => {\n  console.error(`Got error: ${e.message}`);\n});\n\n// Create a local server to receive data from\nconst server = http.createServer((req, res) => {\n  res.writeHead(200, { 'Content-Type': 'application/json' });\n  res.end(JSON.stringify({\n    data: 'Hello World!',\n  }));\n});\n\nserver.listen(8000);\n</code></pre>"
        },
        {
          "textRaw": "`http.request(options[, callback])`",
          "name": "request",
          "type": "method",
          "signatures": [
            {
              "params": [
                {
                  "name": "options"
                },
                {
                  "name": "callback",
                  "optional": true
                }
              ]
            }
          ]
        },
        {
          "textRaw": "`http.request(url[, options][, callback])`",
          "name": "request",
          "type": "method",
          "meta": {
            "added": [
              "v0.3.6"
            ],
            "changes": [
              {
                "version": "v26.3.0",
                "pr-url": "https://github.com/nodejs/node/pull/61597",
                "description": "The `httpValidation` option is supported now."
              },
              {
                "version": [
                  "v16.7.0",
                  "v14.18.0"
                ],
                "pr-url": "https://github.com/nodejs/node/pull/39310",
                "description": "When using a `URL` object parsed username and password will now be properly URI decoded."
              },
              {
                "version": [
                  "v15.3.0",
                  "v14.17.0"
                ],
                "pr-url": "https://github.com/nodejs/node/pull/36048",
                "description": "It is possible to abort a request with an AbortSignal."
              },
              {
                "version": [
                  "v13.8.0",
                  "v12.15.0",
                  "v10.19.0"
                ],
                "pr-url": "https://github.com/nodejs/node/pull/31448",
                "description": "The `insecureHTTPParser` option is supported now."
              },
              {
                "version": "v13.3.0",
                "pr-url": "https://github.com/nodejs/node/pull/30570",
                "description": "The `maxHeaderSize` option is supported now."
              },
              {
                "version": "v10.9.0",
                "pr-url": "https://github.com/nodejs/node/pull/21616",
                "description": "The `url` parameter can now be passed along with a separate `options` object."
              },
              {
                "version": "v7.5.0",
                "pr-url": "https://github.com/nodejs/node/pull/10638",
                "description": "The `options` parameter can be a WHATWG `URL` object."
              }
            ]
          },
          "signatures": [
            {
              "params": [
                {
                  "textRaw": "`url` {string|URL}",
                  "name": "url",
                  "type": "string|URL"
                },
                {
                  "textRaw": "`options` {Object}",
                  "name": "options",
                  "type": "Object",
                  "options": [
                    {
                      "textRaw": "`agent` {http.Agent|boolean} Controls `Agent` behavior. Possible values:",
                      "name": "agent",
                      "type": "http.Agent|boolean",
                      "desc": "Controls `Agent` behavior. Possible values:",
                      "options": [
                        {
                          "textRaw": "`undefined` (default): use `http.globalAgent` for this host and port.",
                          "name": "undefined",
                          "desc": "(default): use `http.globalAgent` for this host and port."
                        },
                        {
                          "textRaw": "`Agent` object: explicitly use the passed in `Agent`.",
                          "name": "Agent",
                          "desc": "object: explicitly use the passed in `Agent`."
                        },
                        {
                          "textRaw": "`false`: causes a new `Agent` with default values to be used.",
                          "name": "false",
                          "desc": "causes a new `Agent` with default values to be used."
                        }
                      ]
                    },
                    {
                      "textRaw": "`auth` {string} Basic authentication (`'user:password'`) to compute an Authorization header.",
                      "name": "auth",
                      "type": "string",
                      "desc": "Basic authentication (`'user:password'`) to compute an Authorization header."
                    },
                    {
                      "textRaw": "`createConnection` {Function} A function that produces a socket/stream to use for the request when the `agent` option is not used. This can be used to avoid creating a custom `Agent` class just to override the default `createConnection` function. See `agent.createConnection()` for more details. Any `Duplex` stream is a valid return value.",
                      "name": "createConnection",
                      "type": "Function",
                      "desc": "A function that produces a socket/stream to use for the request when the `agent` option is not used. This can be used to avoid creating a custom `Agent` class just to override the default `createConnection` function. See `agent.createConnection()` for more details. Any `Duplex` stream is a valid return value."
                    },
                    {
                      "textRaw": "`defaultPort` {number} Default port for the protocol. **Default:** `agent.defaultPort` if an `Agent` is used, else `undefined`.",
                      "name": "defaultPort",
                      "type": "number",
                      "default": "`agent.defaultPort` if an `Agent` is used, else `undefined`",
                      "desc": "Default port for the protocol."
                    },
                    {
                      "textRaw": "`family` {number} IP address family to use when resolving `host` or `hostname`. Valid values are `4` or `6`. When unspecified, both IP v4 and v6 will be used.",
                      "name": "family",
                      "type": "number",
                      "desc": "IP address family to use when resolving `host` or `hostname`. Valid values are `4` or `6`. When unspecified, both IP v4 and v6 will be used."
                    },
                    {
                      "textRaw": "`headers` {Object|Array} An object or an array of strings containing request headers. The array is in the same format as `message.rawHeaders`.",
                      "name": "headers",
                      "type": "Object|Array",
                      "desc": "An object or an array of strings containing request headers. The array is in the same format as `message.rawHeaders`."
                    },
                    {
                      "textRaw": "`hints` {number} Optional `dns.lookup()` hints.",
                      "name": "hints",
                      "type": "number",
                      "desc": "Optional `dns.lookup()` hints."
                    },
                    {
                      "textRaw": "`host` {string} A domain name or IP address of the server to issue the request to. **Default:** `'localhost'`.",
                      "name": "host",
                      "type": "string",
                      "default": "`'localhost'`",
                      "desc": "A domain name or IP address of the server to issue the request to."
                    },
                    {
                      "textRaw": "`hostname` {string} Alias for `host`. To support `url.parse()`, `hostname` will be used if both `host` and `hostname` are specified.",
                      "name": "hostname",
                      "type": "string",
                      "desc": "Alias for `host`. To support `url.parse()`, `hostname` will be used if both `host` and `hostname` are specified."
                    },
                    {
                      "textRaw": "`httpValidation` {string} Controls HTTP header value validation strictness for outgoing requests. Accepted values are:",
                      "name": "httpValidation",
                      "type": "string",
                      "desc": "Controls HTTP header value validation strictness for outgoing requests. Accepted values are:",
                      "options": [
                        {
                          "textRaw": "`'strict'`: Strictest validation; rejects any non-ASCII or control characters in header values.",
                          "desc": "`'strict'`: Strictest validation; rejects any non-ASCII or control characters in header values."
                        },
                        {
                          "textRaw": "`'relaxed'`: Allows a limited set of non-ASCII characters in header values, aligning with the Fetch specification.",
                          "desc": "`'relaxed'`: Allows a limited set of non-ASCII characters in header values, aligning with the Fetch specification."
                        },
                        {
                          "textRaw": "`'insecure'`: Disables all header value validation (equivalent to `insecureHTTPParser: true`). Cannot be used together with `insecureHTTPParser`. **Default:** `'strict'`.",
                          "default": "`'strict'`",
                          "desc": "`'insecure'`: Disables all header value validation (equivalent to `insecureHTTPParser: true`). Cannot be used together with `insecureHTTPParser`."
                        }
                      ]
                    },
                    {
                      "textRaw": "`insecureHTTPParser` {boolean} If set to `true`, it will use an HTTP parser with leniency flags enabled. Using the insecure parser should be avoided. See `--insecure-http-parser` for more information. **Default:** `false`",
                      "name": "insecureHTTPParser",
                      "type": "boolean",
                      "default": "`false`",
                      "desc": "If set to `true`, it will use an HTTP parser with leniency flags enabled. Using the insecure parser should be avoided. See `--insecure-http-parser` for more information."
                    },
                    {
                      "textRaw": "`joinDuplicateHeaders` {boolean} It joins the field line values of multiple headers in a request with `, ` instead of discarding the duplicates. See `message.headers` for more information. **Default:** `false`.",
                      "name": "joinDuplicateHeaders",
                      "type": "boolean",
                      "default": "`false`",
                      "desc": "It joins the field line values of multiple headers in a request with `, ` instead of discarding the duplicates. See `message.headers` for more information."
                    },
                    {
                      "textRaw": "`localAddress` {string} Local interface to bind for network connections.",
                      "name": "localAddress",
                      "type": "string",
                      "desc": "Local interface to bind for network connections."
                    },
                    {
                      "textRaw": "`localPort` {number} Local port to connect from.",
                      "name": "localPort",
                      "type": "number",
                      "desc": "Local port to connect from."
                    },
                    {
                      "textRaw": "`lookup` {Function} Custom lookup function. **Default:** `dns.lookup()`.",
                      "name": "lookup",
                      "type": "Function",
                      "default": "`dns.lookup()`",
                      "desc": "Custom lookup function."
                    },
                    {
                      "textRaw": "`maxHeaderSize` {number} Optionally overrides the value of `--max-http-header-size` (the maximum length of response headers in bytes) for responses received from the server. **Default:** 16384 (16 KiB).",
                      "name": "maxHeaderSize",
                      "type": "number",
                      "default": "16384 (16 KiB)",
                      "desc": "Optionally overrides the value of `--max-http-header-size` (the maximum length of response headers in bytes) for responses received from the server."
                    },
                    {
                      "textRaw": "`method` {string} A string specifying the HTTP request method. **Default:** `'GET'`.",
                      "name": "method",
                      "type": "string",
                      "default": "`'GET'`",
                      "desc": "A string specifying the HTTP request method."
                    },
                    {
                      "textRaw": "`path` {string} Request path. Should include query string if any. E.G. `'/index.html?page=12'`. An exception is thrown when the request path contains illegal characters. Currently, only spaces are rejected but that may change in the future. **Default:** `'/'`.",
                      "name": "path",
                      "type": "string",
                      "default": "`'/'`",
                      "desc": "Request path. Should include query string if any. E.G. `'/index.html?page=12'`. An exception is thrown when the request path contains illegal characters. Currently, only spaces are rejected but that may change in the future."
                    },
                    {
                      "textRaw": "`port` {number} Port of remote server. **Default:** `defaultPort` if set, else `80`.",
                      "name": "port",
                      "type": "number",
                      "default": "`defaultPort` if set, else `80`",
                      "desc": "Port of remote server."
                    },
                    {
                      "textRaw": "`protocol` {string} Protocol to use. **Default:** `'http:'`.",
                      "name": "protocol",
                      "type": "string",
                      "default": "`'http:'`",
                      "desc": "Protocol to use."
                    },
                    {
                      "textRaw": "`setDefaultHeaders` {boolean}: Specifies whether or not to automatically add default headers such as `Connection`, `Content-Length`, `Transfer-Encoding`, and `Host`. If set to `false` then all necessary headers must be added manually. Defaults to `true`.",
                      "name": "setDefaultHeaders",
                      "type": "boolean",
                      "desc": ": Specifies whether or not to automatically add default headers such as `Connection`, `Content-Length`, `Transfer-Encoding`, and `Host`. If set to `false` then all necessary headers must be added manually. Defaults to `true`."
                    },
                    {
                      "textRaw": "`setHost` {boolean}: Specifies whether or not to automatically add the `Host` header. If provided, this overrides `setDefaultHeaders`. Defaults to `true`.",
                      "name": "setHost",
                      "type": "boolean",
                      "desc": ": Specifies whether or not to automatically add the `Host` header. If provided, this overrides `setDefaultHeaders`. Defaults to `true`."
                    },
                    {
                      "textRaw": "`signal` {AbortSignal}: An AbortSignal that may be used to abort an ongoing request.",
                      "name": "signal",
                      "type": "AbortSignal",
                      "desc": ": An AbortSignal that may be used to abort an ongoing request."
                    },
                    {
                      "textRaw": "`socketPath` {string} Unix domain socket. Cannot be used if one of `host` or `port` is specified, as those specify a TCP Socket.",
                      "name": "socketPath",
                      "type": "string",
                      "desc": "Unix domain socket. Cannot be used if one of `host` or `port` is specified, as those specify a TCP Socket."
                    },
                    {
                      "textRaw": "`timeout` {number}: A number specifying the socket timeout in milliseconds. This will set the timeout before the socket is connected.",
                      "name": "timeout",
                      "type": "number",
                      "desc": ": A number specifying the socket timeout in milliseconds. This will set the timeout before the socket is connected."
                    },
                    {
                      "textRaw": "`uniqueHeaders` {Array} A list of request headers that should be sent only once. If the header's value is an array, the items will be joined using `; `.",
                      "name": "uniqueHeaders",
                      "type": "Array",
                      "desc": "A list of request headers that should be sent only once. If the header's value is an array, the items will be joined using `; `."
                    }
                  ],
                  "optional": true
                },
                {
                  "textRaw": "`callback` {Function}",
                  "name": "callback",
                  "type": "Function",
                  "optional": true
                }
              ],
              "return": {
                "textRaw": "Returns: {http.ClientRequest}",
                "name": "return",
                "type": "http.ClientRequest"
              }
            }
          ],
          "desc": "<p><code>options</code> in <a href=\"net.html#socketconnectoptions-connectlistener\"><code>socket.connect()</code></a> are also supported.</p>\n<p>Node.js maintains several connections per server to make HTTP requests.\nThis function allows one to transparently issue requests.</p>\n<p><code>url</code> can be a string or a <a href=\"url.html#the-whatwg-url-api\"><code>URL</code></a> object. If <code>url</code> is a\nstring, it is automatically parsed with <a href=\"url.html#new-urlinput-base\"><code>new URL()</code></a>. If it is a <a href=\"url.html#the-whatwg-url-api\"><code>URL</code></a>\nobject, it will be automatically converted to an ordinary <code>options</code> object.</p>\n<p>If both <code>url</code> and <code>options</code> are specified, the objects are merged, with the\n<code>options</code> properties taking precedence.</p>\n<p>The optional <code>callback</code> parameter will be added as a one-time listener for\nthe <a href=\"#event-response\"><code>'response'</code></a> event.</p>\n<p><code>http.request()</code> returns an instance of the <a href=\"#class-httpclientrequest\"><code>http.ClientRequest</code></a>\nclass. The <code>ClientRequest</code> instance is a writable stream. If one needs to\nupload a file with a POST request, then write to the <code>ClientRequest</code> object.</p>\n<pre><code class=\"language-mjs\">import http from 'node:http';\nimport { Buffer } from 'node:buffer';\n\nconst postData = JSON.stringify({\n  'msg': 'Hello World!',\n});\n\nconst options = {\n  hostname: 'www.google.com',\n  port: 80,\n  path: '/upload',\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'Content-Length': Buffer.byteLength(postData),\n  },\n};\n\nconst req = http.request(options, (res) => {\n  console.log(`STATUS: ${res.statusCode}`);\n  console.log(`HEADERS: ${JSON.stringify(res.headers)}`);\n  res.setEncoding('utf8');\n  res.on('data', (chunk) => {\n    console.log(`BODY: ${chunk}`);\n  });\n  res.on('end', () => {\n    console.log('No more data in response.');\n  });\n});\n\nreq.on('error', (e) => {\n  console.error(`problem with request: ${e.message}`);\n});\n\n// Write data to request body\nreq.write(postData);\nreq.end();\n</code></pre>\n<pre><code class=\"language-cjs\">const http = require('node:http');\n\nconst postData = JSON.stringify({\n  'msg': 'Hello World!',\n});\n\nconst options = {\n  hostname: 'www.google.com',\n  port: 80,\n  path: '/upload',\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'Content-Length': Buffer.byteLength(postData),\n  },\n};\n\nconst req = http.request(options, (res) => {\n  console.log(`STATUS: ${res.statusCode}`);\n  console.log(`HEADERS: ${JSON.stringify(res.headers)}`);\n  res.setEncoding('utf8');\n  res.on('data', (chunk) => {\n    console.log(`BODY: ${chunk}`);\n  });\n  res.on('end', () => {\n    console.log('No more data in response.');\n  });\n});\n\nreq.on('error', (e) => {\n  console.error(`problem with request: ${e.message}`);\n});\n\n// Write data to request body\nreq.write(postData);\nreq.end();\n</code></pre>\n<p>In the example <code>req.end()</code> was called. With <code>http.request()</code> one\nmust always call <code>req.end()</code> to signify the end of the request -\neven if there is no data being written to the request body.</p>\n<p>If any error is encountered during the request (be that with DNS resolution,\nTCP level errors, or actual HTTP parse errors) an <code>'error'</code> event is emitted\non the returned request object. As with all <code>'error'</code> events, if no listeners\nare registered the error will be thrown.</p>\n<p>There are a few special headers that should be noted.</p>\n<ul>\n<li>\n<p>Sending a 'Connection: keep-alive' will notify Node.js that the connection to\nthe server should be persisted until the next request.</p>\n</li>\n<li>\n<p>Sending a 'Content-Length' header will disable the default chunked encoding.</p>\n</li>\n<li>\n<p>Sending an 'Expect' header will immediately send the request headers.\nUsually, when sending 'Expect: 100-continue', both a timeout and a listener\nfor the <code>'continue'</code> event should be set. See RFC 2616 Section 8.2.3 for more\ninformation.</p>\n</li>\n<li>\n<p>Sending an Authorization header will override using the <code>auth</code> option\nto compute basic authentication.</p>\n</li>\n</ul>\n<p>Example using a <a href=\"url.html#the-whatwg-url-api\"><code>URL</code></a> as <code>options</code>:</p>\n<pre><code class=\"language-js\">const options = new URL('http://abc:xyz@example.com');\n\nconst req = http.request(options, (res) => {\n  // ...\n});\n</code></pre>\n<p>In a successful request, the following events will be emitted in the following\norder:</p>\n<ul>\n<li><code>'socket'</code></li>\n<li><code>'response'</code>\n<ul>\n<li><code>'data'</code> any number of times, on the <code>res</code> object\n(<code>'data'</code> will not be emitted at all if the response body is empty, for\ninstance, in most redirects)</li>\n<li><code>'end'</code> on the <code>res</code> object</li>\n</ul>\n</li>\n<li><code>'close'</code></li>\n</ul>\n<p>In the case of a connection error, the following events will be emitted:</p>\n<ul>\n<li><code>'socket'</code></li>\n<li><code>'error'</code></li>\n<li><code>'close'</code></li>\n</ul>\n<p>In the case of a premature connection close before the response is received,\nthe following events will be emitted in the following order:</p>\n<ul>\n<li><code>'socket'</code></li>\n<li><code>'error'</code> with an error with message <code>'Error: socket hang up'</code> and code\n<code>'ECONNRESET'</code></li>\n<li><code>'close'</code></li>\n</ul>\n<p>In the case of a premature connection close after the response is received,\nthe following events will be emitted in the following order:</p>\n<ul>\n<li><code>'socket'</code></li>\n<li><code>'response'</code>\n<ul>\n<li><code>'data'</code> any number of times, on the <code>res</code> object</li>\n</ul>\n</li>\n<li>(connection closed here)</li>\n<li><code>'aborted'</code> on the <code>res</code> object</li>\n<li><code>'close'</code></li>\n<li><code>'error'</code> on the <code>res</code> object with an error with message\n<code>'Error: aborted'</code> and code <code>'ECONNRESET'</code></li>\n<li><code>'close'</code> on the <code>res</code> object</li>\n</ul>\n<p>If <code>req.destroy()</code> is called before a socket is assigned, the following\nevents will be emitted in the following order:</p>\n<ul>\n<li>(<code>req.destroy()</code> called here)</li>\n<li><code>'error'</code> with an error with message <code>'Error: socket hang up'</code> and code\n<code>'ECONNRESET'</code>, or the error with which <code>req.destroy()</code> was called</li>\n<li><code>'close'</code></li>\n</ul>\n<p>If <code>req.destroy()</code> is called before the connection succeeds, the following\nevents will be emitted in the following order:</p>\n<ul>\n<li><code>'socket'</code></li>\n<li>(<code>req.destroy()</code> called here)</li>\n<li><code>'error'</code> with an error with message <code>'Error: socket hang up'</code> and code\n<code>'ECONNRESET'</code>, or the error with which <code>req.destroy()</code> was called</li>\n<li><code>'close'</code></li>\n</ul>\n<p>If <code>req.destroy()</code> is called after the response is received, the following\nevents will be emitted in the following order:</p>\n<ul>\n<li><code>'socket'</code></li>\n<li><code>'response'</code>\n<ul>\n<li><code>'data'</code> any number of times, on the <code>res</code> object</li>\n</ul>\n</li>\n<li>(<code>req.destroy()</code> called here)</li>\n<li><code>'aborted'</code> on the <code>res</code> object</li>\n<li><code>'close'</code></li>\n<li><code>'error'</code> on the <code>res</code> object with an error with message <code>'Error: aborted'</code>\nand code <code>'ECONNRESET'</code>, or the error with which <code>req.destroy()</code> was called</li>\n<li><code>'close'</code> on the <code>res</code> object</li>\n</ul>\n<p>If <code>req.abort()</code> is called before a socket is assigned, the following\nevents will be emitted in the following order:</p>\n<ul>\n<li>(<code>req.abort()</code> called here)</li>\n<li><code>'abort'</code></li>\n<li><code>'close'</code></li>\n</ul>\n<p>If <code>req.abort()</code> is called before the connection succeeds, the following\nevents will be emitted in the following order:</p>\n<ul>\n<li><code>'socket'</code></li>\n<li>(<code>req.abort()</code> called here)</li>\n<li><code>'abort'</code></li>\n<li><code>'error'</code> with an error with message <code>'Error: socket hang up'</code> and code\n<code>'ECONNRESET'</code></li>\n<li><code>'close'</code></li>\n</ul>\n<p>If <code>req.abort()</code> is called after the response is received, the following\nevents will be emitted in the following order:</p>\n<ul>\n<li><code>'socket'</code></li>\n<li><code>'response'</code>\n<ul>\n<li><code>'data'</code> any number of times, on the <code>res</code> object</li>\n</ul>\n</li>\n<li>(<code>req.abort()</code> called here)</li>\n<li><code>'abort'</code></li>\n<li><code>'aborted'</code> on the <code>res</code> object</li>\n<li><code>'error'</code> on the <code>res</code> object with an error with message\n<code>'Error: aborted'</code> and code <code>'ECONNRESET'</code>.</li>\n<li><code>'close'</code></li>\n<li><code>'close'</code> on the <code>res</code> object</li>\n</ul>\n<p>Setting the <code>timeout</code> option or using the <code>setTimeout()</code> function will\nnot abort the request or do anything besides add a <code>'timeout'</code> event.</p>\n<p>Passing an <code>AbortSignal</code> and then calling <code>abort()</code> on the corresponding\n<code>AbortController</code> will behave the same way as calling <code>.destroy()</code> on the\nrequest. Specifically, the <code>'error'</code> event will be emitted with an error with\nthe message <code>'AbortError: The operation was aborted'</code>, the code <code>'ABORT_ERR'</code>\nand the <code>cause</code>, if one was provided.</p>"
        },
        {
          "textRaw": "`http.validateHeaderName(name[, label])`",
          "name": "validateHeaderName",
          "type": "method",
          "meta": {
            "added": [
              "v14.3.0"
            ],
            "changes": [
              {
                "version": [
                  "v19.5.0",
                  "v18.14.0"
                ],
                "pr-url": "https://github.com/nodejs/node/pull/46143",
                "description": "The `label` parameter is added."
              }
            ]
          },
          "signatures": [
            {
              "params": [
                {
                  "textRaw": "`name` {string}",
                  "name": "name",
                  "type": "string"
                },
                {
                  "textRaw": "`label` {string} Label for error message. **Default:** `'Header name'`.",
                  "name": "label",
                  "type": "string",
                  "default": "`'Header name'`",
                  "desc": "Label for error message.",
                  "optional": true
                }
              ]
            }
          ],
          "desc": "<p>Performs the low-level validations on the provided <code>name</code> that are done when\n<code>res.setHeader(name, value)</code> is called.</p>\n<p>Passing illegal value as <code>name</code> will result in a <a href=\"errors.html#class-typeerror\"><code>TypeError</code></a> being thrown,\nidentified by <code>code: 'ERR_INVALID_HTTP_TOKEN'</code>.</p>\n<p>It is not necessary to use this method before passing headers to an HTTP request\nor response. The HTTP module will automatically validate such headers.</p>\n<p>Example:</p>\n<pre><code class=\"language-mjs\">import { validateHeaderName } from 'node:http';\n\ntry {\n  validateHeaderName('');\n} catch (err) {\n  console.error(err instanceof TypeError); // --> true\n  console.error(err.code); // --> 'ERR_INVALID_HTTP_TOKEN'\n  console.error(err.message); // --> 'Header name must be a valid HTTP token [\"\"]'\n}\n</code></pre>\n<pre><code class=\"language-cjs\">const { validateHeaderName } = require('node:http');\n\ntry {\n  validateHeaderName('');\n} catch (err) {\n  console.error(err instanceof TypeError); // --> true\n  console.error(err.code); // --> 'ERR_INVALID_HTTP_TOKEN'\n  console.error(err.message); // --> 'Header name must be a valid HTTP token [\"\"]'\n}\n</code></pre>"
        },
        {
          "textRaw": "`http.validateHeaderValue(name, value)`",
          "name": "validateHeaderValue",
          "type": "method",
          "meta": {
            "added": [
              "v14.3.0"
            ],
            "changes": []
          },
          "signatures": [
            {
              "params": [
                {
                  "textRaw": "`name` {string}",
                  "name": "name",
                  "type": "string"
                },
                {
                  "textRaw": "`value` {any}",
                  "name": "value",
                  "type": "any"
                }
              ]
            }
          ],
          "desc": "<p>Performs the low-level validations on the provided <code>value</code> that are done when\n<code>res.setHeader(name, value)</code> is called.</p>\n<p>Passing illegal value as <code>value</code> will result in a <a href=\"errors.html#class-typeerror\"><code>TypeError</code></a> being thrown.</p>\n<ul>\n<li>Undefined value error is identified by <code>code: 'ERR_HTTP_INVALID_HEADER_VALUE'</code>.</li>\n<li>Invalid value character error is identified by <code>code: 'ERR_INVALID_CHAR'</code>.</li>\n</ul>\n<p>It is not necessary to use this method before passing headers to an HTTP request\nor response. The HTTP module will automatically validate such headers.</p>\n<p>Examples:</p>\n<pre><code class=\"language-mjs\">import { validateHeaderValue } from 'node:http';\n\ntry {\n  validateHeaderValue('x-my-header', undefined);\n} catch (err) {\n  console.error(err instanceof TypeError); // --> true\n  console.error(err.code === 'ERR_HTTP_INVALID_HEADER_VALUE'); // --> true\n  console.error(err.message); // --> 'Invalid value \"undefined\" for header \"x-my-header\"'\n}\n\ntry {\n  validateHeaderValue('x-my-header', 'oʊmɪɡə');\n} catch (err) {\n  console.error(err instanceof TypeError); // --> true\n  console.error(err.code === 'ERR_INVALID_CHAR'); // --> true\n  console.error(err.message); // --> 'Invalid character in header content [\"x-my-header\"]'\n}\n</code></pre>\n<pre><code class=\"language-cjs\">const { validateHeaderValue } = require('node:http');\n\ntry {\n  validateHeaderValue('x-my-header', undefined);\n} catch (err) {\n  console.error(err instanceof TypeError); // --> true\n  console.error(err.code === 'ERR_HTTP_INVALID_HEADER_VALUE'); // --> true\n  console.error(err.message); // --> 'Invalid value \"undefined\" for header \"x-my-header\"'\n}\n\ntry {\n  validateHeaderValue('x-my-header', 'oʊmɪɡə');\n} catch (err) {\n  console.error(err instanceof TypeError); // --> true\n  console.error(err.code === 'ERR_INVALID_CHAR'); // --> true\n  console.error(err.message); // --> 'Invalid character in header content [\"x-my-header\"]'\n}\n</code></pre>"
        },
        {
          "textRaw": "`http.setMaxIdleHTTPParsers(max)`",
          "name": "setMaxIdleHTTPParsers",
          "type": "method",
          "meta": {
            "added": [
              "v18.8.0",
              "v16.18.0"
            ],
            "changes": []
          },
          "signatures": [
            {
              "params": [
                {
                  "textRaw": "`max` {number} **Default:** `1000`.",
                  "name": "max",
                  "type": "number",
                  "default": "`1000`"
                }
              ]
            }
          ],
          "desc": "<p>Set the maximum number of idle HTTP parsers.</p>"
        },
        {
          "textRaw": "`http.setGlobalProxyFromEnv([proxyEnv])`",
          "name": "setGlobalProxyFromEnv",
          "type": "method",
          "meta": {
            "added": [
              "v25.4.0",
              "v24.14.0"
            ],
            "changes": []
          },
          "signatures": [
            {
              "params": [
                {
                  "textRaw": "`proxyEnv` {Object} An object containing proxy configuration. This accepts the same options as the `proxyEnv` option accepted by `Agent`. **Default:** `process.env`.",
                  "name": "proxyEnv",
                  "type": "Object",
                  "default": "`process.env`",
                  "desc": "An object containing proxy configuration. This accepts the same options as the `proxyEnv` option accepted by `Agent`.",
                  "optional": true
                }
              ],
              "return": {
                "textRaw": "Returns: {Function} A function that restores the original agent and dispatcher settings to the state before this `http.setGlobalProxyFromEnv()` is invoked.",
                "name": "return",
                "type": "Function",
                "desc": "A function that restores the original agent and dispatcher settings to the state before this `http.setGlobalProxyFromEnv()` is invoked."
              }
            }
          ],
          "desc": "<p>Dynamically resets the global configurations to enable built-in proxy support for\n<code>fetch()</code> and <code>http.request()</code>/<code>https.request()</code> at runtime, as an alternative\nto using the <code>--use-env-proxy</code> flag or <code>NODE_USE_ENV_PROXY</code> environment variable.\nIt can also be used to override settings configured from the environment variables.</p>\n<p>As this function resets the global configurations, any previously configured\n<code>http.globalAgent</code>, <code>https.globalAgent</code> or undici global dispatcher would be\noverridden after this function is invoked. It's recommended to invoke it before any\nrequests are made and avoid invoking it in the middle of any requests.</p>\n<p>See <a href=\"#built-in-proxy-support\">Built-in Proxy Support</a> for details on proxy URL formats and <code>NO_PROXY</code>\nsyntax.</p>"
        }
      ],
      "modules": [
        {
          "textRaw": "Built-in Proxy Support",
          "name": "built-in_proxy_support",
          "type": "module",
          "meta": {
            "added": [
              "v24.5.0",
              "v22.21.0"
            ],
            "changes": []
          },
          "stability": 1.1,
          "stabilityText": "Active development",
          "desc": "<p>When Node.js creates the global agent, if the <code>NODE_USE_ENV_PROXY</code> environment variable is\nset to <code>1</code> or <code>--use-env-proxy</code> is enabled, the global agent will be constructed\nwith <code>proxyEnv: process.env</code>, enabling proxy support based on the environment variables.</p>\n<p>To enable proxy support dynamically and globally, use <a href=\"#httpsetglobalproxyfromenvproxyenv\"><code>http.setGlobalProxyFromEnv()</code></a>.</p>\n<p>Custom agents can also be created with proxy support by passing a\n<code>proxyEnv</code> option when constructing the agent. The value can be <code>process.env</code>\nif they just want to inherit the configuration from the environment variables,\nor an object with specific setting overriding the environment.</p>\n<p>The following properties of the <code>proxyEnv</code> are checked to configure proxy\nsupport.</p>\n<ul>\n<li><code>HTTP_PROXY</code> or <code>http_proxy</code>: Proxy server URL for HTTP requests. If both are set,\n<code>http_proxy</code> takes precedence.</li>\n<li><code>HTTPS_PROXY</code> or <code>https_proxy</code>: Proxy server URL for HTTPS requests. If both are set,\n<code>https_proxy</code> takes precedence.</li>\n<li><code>NO_PROXY</code> or <code>no_proxy</code>: Comma-separated list of hosts to bypass the proxy. If both are set,\n<code>no_proxy</code> takes precedence.</li>\n</ul>\n<p>If the request is made to a Unix domain socket, the proxy settings will be ignored.</p>",
          "modules": [
            {
              "textRaw": "Proxy URL Format",
              "name": "proxy_url_format",
              "type": "module",
              "desc": "<p>Proxy URLs can use either HTTP or HTTPS protocols:</p>\n<ul>\n<li>HTTP proxy: <code>http://proxy.example.com:8080</code></li>\n<li>HTTPS proxy: <code>https://proxy.example.com:8080</code></li>\n<li>Proxy with authentication: <code>http://username:password@proxy.example.com:8080</code></li>\n</ul>",
              "displayName": "Proxy URL Format"
            },
            {
              "textRaw": "`NO_PROXY` Format",
              "name": "`no_proxy`_format",
              "type": "module",
              "desc": "<p>The <code>NO_PROXY</code> environment variable supports several formats:</p>\n<ul>\n<li><code>*</code> - Bypass proxy for all hosts</li>\n<li><code>example.com</code> - Exact host name match</li>\n<li><code>.example.com</code> - Domain suffix match (matches <code>sub.example.com</code>)</li>\n<li><code>*.example.com</code> - Wildcard domain match</li>\n<li><code>192.168.1.100</code> - Exact IP address match</li>\n<li><code>192.168.1.1-192.168.1.100</code> - IP address range</li>\n<li><code>example.com:8080</code> - Hostname with specific port</li>\n</ul>\n<p>Multiple entries should be separated by commas.</p>",
              "displayName": "`NO_PROXY` Format"
            },
            {
              "textRaw": "Example",
              "name": "example",
              "type": "module",
              "desc": "<p>To start a Node.js process with proxy support enabled for all requests sent\nthrough the default global agent, either use the <code>NODE_USE_ENV_PROXY</code> environment\nvariable:</p>\n<pre><code class=\"language-console\">NODE_USE_ENV_PROXY=1 HTTP_PROXY=http://proxy.example.com:8080 NO_PROXY=localhost,127.0.0.1 node client.js\n</code></pre>\n<p>Or the <code>--use-env-proxy</code> flag.</p>\n<pre><code class=\"language-console\">HTTP_PROXY=http://proxy.example.com:8080 NO_PROXY=localhost,127.0.0.1 node --use-env-proxy client.js\n</code></pre>\n<p>To enable proxy support dynamically and globally with <code>process.env</code> (the default option of <code>http.setGlobalProxyFromEnv()</code>):</p>\n<pre><code class=\"language-cjs\">const http = require('node:http');\n\n// Reads proxy-related environment variables from process.env\nconst restore = http.setGlobalProxyFromEnv();\n\n// Subsequent requests will use the configured proxies from environment variables\nhttp.get('http://www.example.com', (res) => {\n  // This request will be proxied if HTTP_PROXY or http_proxy is set\n});\n\nfetch('https://www.example.com', (res) => {\n  // This request will be proxied if HTTPS_PROXY or https_proxy is set\n});\n\n// To restore the original global agent and dispatcher settings, call the returned function.\n// restore();\n</code></pre>\n<pre><code class=\"language-mjs\">import http from 'node:http';\n\n// Reads proxy-related environment variables from process.env\nhttp.setGlobalProxyFromEnv();\n\n// Subsequent requests will use the configured proxies from environment variables\nhttp.get('http://www.example.com', (res) => {\n  // This request will be proxied if HTTP_PROXY or http_proxy is set\n});\n\nfetch('https://www.example.com', (res) => {\n  // This request will be proxied if HTTPS_PROXY or https_proxy is set\n});\n\n// To restore the original global agent and dispatcher settings, call the returned function.\n// restore();\n</code></pre>\n<p>To enable proxy support dynamically and globally with custom settings:</p>\n<pre><code class=\"language-cjs\">const http = require('node:http');\n\nconst restore = http.setGlobalProxyFromEnv({\n  http_proxy: 'http://proxy.example.com:8080',\n  https_proxy: 'https://proxy.example.com:8443',\n  no_proxy: 'localhost,127.0.0.1,.internal.example.com',\n});\n\n// Subsequent requests will use the configured proxies\nhttp.get('http://www.example.com', (res) => {\n  // This request will be proxied through proxy.example.com:8080\n});\n\nfetch('https://www.example.com', (res) => {\n  // This request will be proxied through proxy.example.com:8443\n});\n</code></pre>\n<pre><code class=\"language-mjs\">import http from 'node:http';\n\nhttp.setGlobalProxyFromEnv({\n  http_proxy: 'http://proxy.example.com:8080',\n  https_proxy: 'https://proxy.example.com:8443',\n  no_proxy: 'localhost,127.0.0.1,.internal.example.com',\n});\n\n// Subsequent requests will use the configured proxies\nhttp.get('http://www.example.com', (res) => {\n  // This request will be proxied through proxy.example.com:8080\n});\n\nfetch('https://www.example.com', (res) => {\n  // This request will be proxied through proxy.example.com:8443\n});\n</code></pre>\n<p>To create a custom agent with built-in proxy support:</p>\n<pre><code class=\"language-cjs\">const http = require('node:http');\n\n// Creating a custom agent with custom proxy support.\nconst agent = new http.Agent({ proxyEnv: { HTTP_PROXY: 'http://proxy.example.com:8080' } });\n\nhttp.request({\n  hostname: 'www.example.com',\n  port: 80,\n  path: '/',\n  agent,\n}, (res) => {\n  // This request will be proxied through proxy.example.com:8080 using the HTTP protocol.\n  console.log(`STATUS: ${res.statusCode}`);\n});\n</code></pre>\n<p>Alternatively, the following also works:</p>\n<pre><code class=\"language-cjs\">const http = require('node:http');\n// Use lower-cased option name.\nconst agent1 = new http.Agent({ proxyEnv: { http_proxy: 'http://proxy.example.com:8080' } });\n// Use values inherited from the environment variables, if the process is started with\n// HTTP_PROXY=http://proxy.example.com:8080 this will use the proxy server specified\n// in process.env.HTTP_PROXY.\nconst agent2 = new http.Agent({ proxyEnv: process.env });\n</code></pre>",
              "displayName": "Example"
            }
          ],
          "displayName": "Built-in Proxy Support"
        }
      ],
      "displayName": "HTTP"
    }
  ]
}