summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/node/polyfills/http.ts6
1 files changed, 5 insertions, 1 deletions
diff --git a/ext/node/polyfills/http.ts b/ext/node/polyfills/http.ts
index b34c45f9c..2d80c2cd9 100644
--- a/ext/node/polyfills/http.ts
+++ b/ext/node/polyfills/http.ts
@@ -1438,6 +1438,7 @@ export class ServerResponse extends NodeWritable {
// TODO(@AaronO): optimize
export class IncomingMessageForServer extends NodeReadable {
#req: Request;
+ #headers: Record<string, string>;
url: string;
method: string;
// Polyfills part of net.Socket object.
@@ -1484,7 +1485,10 @@ export class IncomingMessageForServer extends NodeReadable {
}
get headers() {
- return Object.fromEntries(this.#req.headers.entries());
+ if (!this.#headers) {
+ this.#headers = Object.fromEntries(this.#req.headers.entries());
+ }
+ return this.#headers;
}
get upgrade(): boolean {