Using both `c.body` and `c.json` in an endpoint results in `response.json()` of `Promise<unknown>`
hi everyone, is there any way to get the response type working when i have endpoints that return multiple type of content based on status code?
this is an example where it fails to infer the type
1 Reply
A null body is not json, it's an empty body. You first need to check to see if the response is JSON, then you can read the json if it exists. Something like this: