Workers request.body empty
I'm running a worker locally whose work is to return the request.body back, and I made a POST request with some body in application/json format, but in response I get {}, but request.cf is working perfectly, and on request.bodyUsed, I get false
export default {
async fetch(request, env, ctx) {
const { pathname } = new URL(request.url);
if (pathname === "/api/modify") {
return Response.json(request.body);
}
}
}
2 Replies