| 1146 | ]) |
| 1147 | |
| 1148 | const withoutConnectionHeaders = ( |
| 1149 | headers: Record<string, string | Array<string>> |
| 1150 | ): Record<string, string | Array<string>> => { |
| 1151 | let result: Record<string, string | Array<string>> | undefined |
| 1152 | for (const name in headers) { |
| 1153 | if (connectionHeaders.has(name) || (name === "te" && headers[name] !== "trailers")) { |
| 1154 | result ??= { ...headers } |
| 1155 | delete result[name] |
| 1156 | } |
| 1157 | } |
| 1158 | return result ?? headers |
| 1159 | } |
| 1160 | |
| 1161 | // Unread request body discarded after the response to keep the connection alive. Past this it closes. |
| 1162 | const maxDrainBytes = 256 * 1024 |