Itty Router library wont return Response if a body is attached

We have a Cloudflare worker and are using the Itty router library. We have come across a scenario when sending a POST request to an endpoint, when there is a body attached a response is never returned and the request hangs:

More Detail:

There is an endpoint: /api/geab/lead/v1

We have headers: token:

We have body:
city: ‘London’
street: ‘123 Sesame Street’
phone: ‘07712345678’

When sending a request with correct headers, the post request will send successfully.
When there is an invalid token, or an invalid method on the request, the Response is never met when there is a body send in the request. If we remove the body a response is sent each time.

Our middleware examples:


There is a catch all, recently updated by itty router in 2.3.6, to handle all invalid methods:

.all(’*’, (request: { url: string; headers: Map<string, string> }) => {
return new Response(‘Method not allowed’, {
status: 405,
statusText: ‘Method not allowed’,

The result of this request would be a hanging scenario. Has anybody any advice or prior experience with this situation and could offer help?


I’m not entirely sure but if you join the Discord server

The creator of the library is on there so you could ask him directly

1 Like