1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-24 15:19:26 -05:00
denoland-deno/tests/testdata/run/http2_request_url.ts
Asher Gomez 7937ae3f2f
chore(net): soft-remove Deno.serveHttp() (#25451)
Towards #22079

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-09-06 08:15:00 +10:00

13 lines
347 B
TypeScript

const listener = Deno.listen({
port: Number(Deno.args[0]),
});
console.log("READY");
for await (const conn of listener) {
// @ts-ignore `Deno.serveHttp()` was soft-removed in Deno 2.
for await (const { request, respondWith } of Deno.serveHttp(conn)) {
const href = new URL(request.url).href;
respondWith(new Response(href));
}
}