What happened
two problem:
- http module cannot actually response POST request
- fetch cannot send POST body properly
What you expected
it should work like other runtime
Minimal reproduction
import { createServer } from "node:http";
const httpServer = createServer((req, res) => {
console.log("receive request");
if (req.method === "POST" && req.url === "/echo") {
let chunks: string[] = [];
req.on("data", (chunk: Buffer) => {
console.log("receive data", chunk)
chunks.push(chunk.toString());
});
req.on("end", () => {
const body = chunks.join("");
console.log("receive data end", chunks)
res.statusCode = 200;
res.setHeader("Content-Type", "text/plain");
res.end("got:" + body);
});
return;
}
res.statusCode = 200;
res.setHeader("Content-Type", "application/json");
res.end(`{"path":"${req.url}"}`);
});
httpServer.listen(3000, async () => {
console.log("[node:http] listening on http://0.0.0.0:3000");
console.log("send request");
const response = await fetch("http://localhost:3000/echo", {
method: "POST",
body: Buffer.from("0123456789ABCDEF"),
});
console.log("receive response");
console.log("ECHO", await response.text());
});
Command you ran:
Output:
[node:http] listening on http://0.0.0.0:3000
send request
receive request
receive data <Buffer 43 44 45 46 00 00 00 00 00 00 00 00 00 00 00 00>
receive data end [ 'CDEF' ]
(and no response)
in bun/nodejs
[node:http] listening on http://0.0.0.0:3000
send request
receive request
receive data <Buffer 30 31 32 33 34 35 36 37 38 39 41 42 43 44 45 46>
receive data end [ "0123456789ABCDEF" ]
receive response
ECHO got:0123456789ABCDEF
Environment
- Perry version: perry 0.5.1207
- Host OS: ArchLinux
- Target: native
- Rust toolchain (if building from source): rustc 1.95.0 (59807616e 2026-04-14)
- Installed via: from source
Diagnostic output
Perry Doctor
Environment Checks
──────────────────
✓ perry version: 0.5.1207
✓ update status: up to date
✓ clang (LLVM codegen): clang version 22.1.6
✓ system linker (cc): cc (GCC) 16.1.1 20260625
✓ runtime library: /home/codehz/Projects/perry/target/release/libperry_runtime.a
✓ project config (perry.toml): found
✓ compatibility reports (#849): mode=ask (sent=0, suppressed-by-dedup=0, queued=0, cache=empty)
All checks passed!
Anything else
What happened
two problem:
What you expected
it should work like other runtime
Minimal reproduction
Command you ran:
Output:
(and no response)
in bun/nodejs
Environment
Diagnostic output
Anything else