-
-
Notifications
You must be signed in to change notification settings - Fork 255
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
no catch case in case DELETE request has no body #495
Comments
Fixed in 711925a under If resolved, please leave the issue opened until release on next stable release. |
@SaltyAom when the body is extracted or accessed the following error is thrown:
It no longer erros with unexpected end of json input but still throwing when trying to parse the body on an .onRequest(async ({ request }) => {
console.log('< req.url =', request.url);
console.log('< req.method =', request.method);
console.log('< req.headers =', request.headers);
})
.onBeforeHandle(async ({ body }) => {
console.log('< req.body =', body);
console.log();
})
.onResponse(async ({ set }) => {
console.log('> status =', set.status);
console.log();
}) I think we should have a default value for the body if possible (when type is explicitly set?), in cases where the body hasn't been parsed or cant be known ( PD: Out of the scope of this ticket but would be great to have access to the response body on an |
Why would you lie to the server about the content-type? |
Fixed with 1678c63. Feel free to reopen the issue if the problem still persists. |
What version of Elysia.JS is running?
0.8.17
What platform is your computer?
Linux 6.5.5-arch1-1 x86_64 unknown
What steps can reproduce the bug?
What is the expected behavior?
don't throw an error if the request has no body, or provide a descriptive error message letting the developer know that the error is being thrown because he has setten 'Content-type': 'aplication/json' but there was an error parsing the body.
or explain that the request body is going to be parsed always.
What do you see instead?
Additional information
No response
The text was updated successfully, but these errors were encountered: