Skip to content

Commit e63a34d

Browse files
committed
fix: lazy inherit property symbols too
1 parent 6f93cc7 commit e63a34d

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

src/_inherit.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
export function lazyInherit(target: any, source: any, sourceKey: any): void {
2-
for (const key of Object.getOwnPropertyNames(source)) {
2+
for (const key of [
3+
...Object.getOwnPropertyNames(source),
4+
...Object.getOwnPropertySymbols(source),
5+
]) {
36
if (key === "constructor") continue;
47
const targetDesc = Object.getOwnPropertyDescriptor(target, key)!;
58
const desc = Object.getOwnPropertyDescriptor(source, key)!;

test/_fixture.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { inspect } from "node:util";
12
import type { ServerOptions } from "../src/types.ts";
23

34
// prettier-ignore
@@ -213,6 +214,11 @@ export const fixture: (
213214
case "/abort-log": {
214215
return _Response.json(aborts);
215216
}
217+
case "/node-inspect": {
218+
return _Response.json({
219+
headers: inspect(req.headers),
220+
});
221+
}
216222
}
217223
return new _Response("404", { status: 404 });
218224
},

test/_tests.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,15 @@ export function addTests(opts: {
234234
});
235235
});
236236

237+
test("inspect objects", async () => {
238+
const response = await fetch(url("/node-inspect"), {
239+
headers: { "x-foo": "1" },
240+
});
241+
expect(response.status).toBe(200);
242+
const data = await response.text();
243+
expect(data.includes("x-foo"));
244+
});
245+
237246
// TODO: Write test to make sure it is forbidden for http2/tls
238247
test.skipIf(opts.http2)("absolute path in request line", async () => {
239248
const _url = new URL(url("/"));

0 commit comments

Comments
 (0)