You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm having an issue with Deno 1.18.2 and oak 10.2.1 related with #430 where I'm sending a POST request with body set to none using Postman and I get an Internal Server Error with the following message:
[uncaught application error]: SyntaxError - Unexpected end of JSON input
request: { url: "http://localhost:8000/v1/products/", method: "POST", hasBody: true }
Also, in this case as you can see .hasBody is set to true. I know since #430 was resolved, this means the request might have a body, but I'm unable to check the inside of the body value as when trying to log it on the console it throws the aforementioned error. I'm trying this in order to check the content of value to return a 404 response in case is undefined.
Also, when trying this with curl (curl -X POST --url http://localhost:8000/v1/products -H Content-Type:\ application/json) instead of Postman instead of the error above the following gets thrown:
[uncaught application error]: RangeError - Body exceeds a limit of 10485760.
request: { url: "http://localhost:8000/v1/products", method: "POST", hasBody: true }
I'm not 100% sure how to proceed from here, but I think something odd is going on here.
Thanks.
The text was updated successfully, but these errors were encountered:
As when the body comes empty comes as undefined and trying to run that same thing in a deno environment throws the same error:
> const decoder = new TextDecoder()
undefined
> JSON.parse(decoder.decode(undefined))
Uncaught SyntaxError: Unexpected end of JSON input
at JSON.parse (<anonymous>)
at <anonymous>:2:6
I'm not so sure on how to tackle the solution myself, but if I came up with something I'll post it here.
I had a similar issue. I solved it with setting Content-Length header on the request to the body size. "Content-Length": `${JSON.stringify(body).length}`
I had a similar issue. I solved it with setting Content-Length header on the request to the body size. "Content-Length": `${JSON.stringify(body).length}`
Hi,
I'm having an issue with Deno 1.18.2 and oak 10.2.1 related with #430 where I'm sending a POST request with body set to
none
using Postman and I get an Internal Server Error with the following message:Also, in this case as you can see
.hasBody
is set totrue
. I know since #430 was resolved, this means the request might have a body, but I'm unable to check the inside of the body value as when trying to log it on the console it throws the aforementioned error. I'm trying this in order to check the content of value to return a 404 response in case isundefined
.Also, when trying this with
curl
(curl -X POST --url http://localhost:8000/v1/products -H Content-Type:\ application/json
) instead of Postman instead of the error above the following gets thrown:I'm not 100% sure how to proceed from here, but I think something odd is going on here.
Thanks.
The text was updated successfully, but these errors were encountered: