From 59f419bf410e861c49cdfa6c1b0e657cf8bcc8e3 Mon Sep 17 00:00:00 2001 From: Marvin Hagemeister Date: Fri, 19 Jan 2024 13:09:37 +0100 Subject: fix(node/http): remoteAddress and remotePort not being set (#21998) Ultimately, it came down to using incorrect property names in the `FakeSocket` constructor. The values are passed under `remoteAddress`, not `hostname` and `remotePort` instead of `port`. Fixes https://github.com/denoland/deno/issues/21980 --- ext/node/polyfills/http.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'ext/node') diff --git a/ext/node/polyfills/http.ts b/ext/node/polyfills/http.ts index 9654d3beb..2da19f7f5 100644 --- a/ext/node/polyfills/http.ts +++ b/ext/node/polyfills/http.ts @@ -283,10 +283,16 @@ const kError = Symbol("kError"); const kUniqueHeaders = Symbol("kUniqueHeaders"); class FakeSocket extends EventEmitter { - constructor(opts = {}) { + constructor( + opts: { + encrypted?: boolean | undefined; + remotePort?: number | undefined; + remoteAddress?: string | undefined; + } = {}, + ) { super(); - this.remoteAddress = opts.hostname; - this.remotePort = opts.port; + this.remoteAddress = opts.remoteAddress; + this.remotePort = opts.remotePort; this.encrypted = opts.encrypted; this.writable = true; this.readable = true; -- cgit v1.2.3