fix: remoteAddr hardcoded to localhost:1234 (#1839)
This commit is contained in:
+12
-1
@@ -60,7 +60,18 @@ async function bootServer(handler: ServeHandler, opts: StartOptions) {
|
||||
// @ts-ignore Ignore type error when type checking with Deno versions
|
||||
if (typeof Deno.serve === "function") {
|
||||
// @ts-ignore Ignore type error when type checking with Deno versions
|
||||
await Deno.serve(opts, handler).finished;
|
||||
await Deno.serve(
|
||||
opts,
|
||||
(r, { remoteAddr }) =>
|
||||
handler(r, {
|
||||
remoteAddr,
|
||||
localAddr: {
|
||||
transport: "tcp",
|
||||
hostname: opts.hostname ?? "localhost",
|
||||
port: opts.port,
|
||||
} as Deno.NetAddr,
|
||||
}),
|
||||
).finished;
|
||||
} else {
|
||||
// @ts-ignore Deprecated std serve way
|
||||
await serve(handler, opts);
|
||||
|
||||
@@ -82,7 +82,7 @@ Deno.test({
|
||||
transport: "tcp",
|
||||
},
|
||||
remoteAddr: {
|
||||
hostname: "localhost",
|
||||
hostname: "127.0.0.1",
|
||||
port: 8000,
|
||||
transport: "tcp",
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user