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
When no body is sent with a request that uses the withContent middleware, a 500 Internal Server Error is returned. The expectation is possibly for a 400 Bad Request instead, since you were expecting a body, but didn't receive one - hence bad input.
Example Router Code
Please provide the itty-router code related to the issue. If possible, create a minimal, reproducible example.
Describe the Issue
When no body is sent with a request that uses the
withContent
middleware, a500 Internal Server Error
is returned. The expectation is possibly for a400 Bad Request
instead, since you were expecting a body, but didn't receive one - hence bad input.Example Router Code
Please provide the itty-router code related to the issue. If possible, create a minimal, reproducible example.
Request Details
POST
,PUT
Content-Type: application/json
Steps to Reproduce
Steps to reproduce the behaviour:
npm
below, but use whatever package manager you like):git clone git@github.com:smcstewart/itty-router-without-content.git cd itty-router-without-content npm install npm run dev
cURL
(or whatever else you like: e.g.httpie
) and perhaps something likejq
for a pretty-printed response:curl -v --request POST \ --url http://localhost:8787/ \ --header 'Content-Type: application/json'
500 Internal Server Error
and the following JSON response:Expected Behaviour
I would expect to see a
400 Bad Request
since the input is bad.Actual Behaviour
It currently returns a
500 Internal Server Error
.Environment (please complete the following information):
4.0.27
node 20.11.0
,wrangler 3.23.0
Additional Context
None.
The text was updated successfully, but these errors were encountered: