fix(accepts): match media types and language tags case-insensitively (#5376)
Before adoption: this commit came in with the history the project adopted, so no landing records it.
* fix(accepts): match media types and language tags case-insensitively `matchType()` compared the accept header entry and the supported value as raw strings, so `Accept: TEXT/HTML` did not match a supported `text/html`, and `Accept-Language: en-us` did not match `en-US`. Both are case-insensitive: media types by RFC 9110 section 8.3.1 and language tags by RFC 4647 section 2.1. #5064 already made `parseBody()` and `validator()` match media types case-insensitively, for #5060. `accepts()` was not covered by that. Compares case-folded. `defaultMatch()` returns the caller's own `supports` entry, so the casing an application registered is preserved. * test: call `accepts()` directly instead of going through a Hono app ---------
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Trailers
- Co-authored-by: Yusuke Wada <yusuke@kamawada.com>
Diff stats
2 files+46 added−5 removed
- tests:+35 added−0 removed
- other:+11 added−5 removed