honojs/hono

Support json subtypes like application/merge-patch+json in validator

Closed this issue · 0 comments

What version of Hono are you using?

4.3.2

What runtime/platform is your app running on?

Bun (but should affect all)

What steps can reproduce the bug?

Create a route with a validator with target 'json'.
Request with a Content-Type Header like 'application/merge-patch+json'

What is the expected behavior?

Validation should not fail with a message like:
Invalid HTTP header: ContentType=application/merge-patch+json.

What do you see instead?

The request should result in a 200, or at least should not fail on this specific check.

Additional information

One could additionally argue, that it should not be the responsibility of the json validator to check the request header.
Instead the the validator with target 'header' should be responsible for this. But I see the convenience and brevity of the current solution.

We also have no option to control the error response in this case.