bunrest
bunrest copied to clipboard
Body already used
OS: WSL Ubuntu 22.04
Bun version: 1.0.36
Bunrest version: ^1.3.8
My code:
app.get("/api/v1/one/:name/:id", async (req, res) => {
const name = req.params?.name;
const id = req.params?.id;
if (!id) {
return res.status(StatusCodes.BAD_REQUEST).json({error: `No ${name} ID provided`});
}
const itemData = await redisClient.get(`${name}:${id}`);
if (!itemData) {
return res.status(StatusCodes.NOT_FOUND).json({error: `${name} not found`});
}
const item = JSON.parse(itemData);
res.json({id, ...item});
}
output for every 30 minutes:
250 | newReq.body = bodyStr
251 | }
252 | req.arrayBuffer;
253 | newReq.blob = req.blob();
^
error: Body already used
at /opt/myprojectname/node_modules/bunrest/src/server/server.ts:253:19