Files
scriptc/tests/corpus/2988-http-static-client-abort.ts
Chris Tate 0b8b5d5bf7 feat(http): expand the static Node HTTP surface (#410)
* feat(http): materialize static distinct header snapshots

- Preserve precise string array types for whole incoming header and trailer collections.
- Cover duplicate headers, trailers, and raw header reads against Node in both backends.
- Refresh test-backed static HTTP compatibility claims.

* feat(http): expand the static Node HTTP surface

- Add HTTP module values, request and response lifecycle state, and socket controls.
- Implement server timeout and connection shutdown behavior in the native runtime.
- Cover C and LLVM behavior with Node differential fixtures, refresh compatibility evidence, and recover interrupted Sandbox streams.

* fix(http): honor message timeout handlers

- Keep server sockets open when request or response timeout listeners handle the event.

- Add differential regressions and refresh the TypeScript 7 order baseline.
2026-09-24 23:39:09 -05:00

33 lines
1.2 KiB
TypeScript

import * as http from "node:http";
const server = http.createServer((incoming, outgoing) => {
incoming.resume();
outgoing.end("ok");
});
server.listen(0, "127.0.0.1", () => {
const port = server.address().port;
const early = http.request({ host: "127.0.0.1", port });
console.log("early before", early.aborted, early.destroyed);
early.on("socket", () => console.log("early socket"));
early.on("error", (error) => console.log("early error", error.message));
early.on("close", () => console.log("early close", early.aborted, early.destroyed));
early.on("abort", () => {
console.log("early abort", early.aborted, early.destroyed);
const late = http.get({ host: "127.0.0.1", port });
late.on("socket", () => {
console.log("late socket", late.aborted, late.destroyed);
late.abort();
console.log("late after", late.aborted, late.destroyed);
});
late.on("abort", () => console.log("late abort", late.aborted, late.destroyed));
late.on("error", (error) => console.log("late error", error.message));
late.on("close", () => {
console.log("late close", late.aborted, late.destroyed);
server.close();
});
});
early.abort();
console.log("early after", early.aborted, early.destroyed);
});