I have route handler which makes an external api call but stuck with an error [nuxt] [request error] [unhandled] [500] The body has already been consumed..
Heres my code:
export default defineEventHandler(async (event) => {
const body = await readBody(event);
const csrfResponse = await $fetch.raw<any>(
"http://localhost:4000/api/csrf_token"
);
const data = await csrfResponse.json();
});
The compiler points the error to line const data = await csrfResponse.json(); but I'm not sure why it happen since this line is the only one using the csrfResponse.