mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 10:28:47 +00:00
23 lines
548 B
JavaScript
23 lines
548 B
JavaScript
// String.prototype.repeat is really slow in debug builds.
|
|
const content = Buffer.alloc(3 * 15360000, "Bun").toString();
|
|
|
|
const server = Bun.serve({
|
|
port: 0,
|
|
idleTimeout: 0,
|
|
fetch: async req => {
|
|
const data = await req.formData();
|
|
return new Response(data.get("name") === content ? "OK" : "NO");
|
|
},
|
|
});
|
|
|
|
const formData = new FormData();
|
|
formData.append("name", content);
|
|
const result = await fetch(server.url, {
|
|
method: "POST",
|
|
body: formData,
|
|
}).then(res => res.text());
|
|
|
|
server.stop();
|
|
|
|
process.exit(result === "OK" ? 0 : 1);
|