Closed ZPiDER666 closed 4 years ago
in the raw request the body function is a getter, so we need to wrap it as a getter here too, otherwise we will not be able to read from the result.
now the following code will work properly. i think in the future it will be convenient to have a function just returning the body as string.
async function getBody(request:pogo.Request) { console.log("MAIN.GETBODY"); const br = request.body; const bufferContent = await Deno.readAll(br); const bodyText = new TextDecoder().decode(bufferContent); return JSON.parse(bodyText); }
in the raw request the body function is a getter, so we need to wrap it as a getter here too, otherwise we will not be able to read from the result.
now the following code will work properly. i think in the future it will be convenient to have a function just returning the body as string.