How to read request body from inside a Deno application? #12601
-
I am trying to write a simple signup using Deno, and the following is my code:
The problem is that, what I get from the frontend side is like below:
But it seems my backend expects something like this:
And when I try to remove that
It gives me error messages like:
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 8 replies
-
The body is the promise which can be awaited, not the value on the body. You need something like this: = (await request.body()).value |
Beta Was this translation helpful? Give feedback.
-
You can access any request body by using However the above will only work if the content type of the incoming request is application/json |
Beta Was this translation helpful? Give feedback.
You can access any request body by using
const result = await ctx.request.body({ type: "json" }).value;
However the above will only work if the content type of the incoming request is application/json