mirror of
https://github.com/oven-sh/bun
synced 2026-02-10 02:48:50 +00:00
15 lines
414 B
JavaScript
15 lines
414 B
JavaScript
const fetch = require("node-fetch");
|
|
|
|
test("require('node-fetch') fetches", async () => {
|
|
// can't use `using`. see https://github.com/oven-sh/bun/issues/11100
|
|
const server = Bun.serve({
|
|
port: 0,
|
|
fetch(req, server) {
|
|
server.stop();
|
|
return new Response();
|
|
},
|
|
});
|
|
expect(await fetch("http://" + server.hostname + ":" + server.port)).toBeInstanceOf(Response);
|
|
server.stop(true);
|
|
});
|