fix(accept): clamp a negative q to 0, not 1 (#5357)
Before adoption: this commit came in with the history the project adopted, so no landing records it.
* fix(accept): clamp a negative q to 0, not 1 parseQuality sent every out-of-range q to 1, so a negative one came back as the highest possible quality. `application/json;q=0.9, text/html;q=-1` sorted text/html first and accepts() picked it, even though the client had written the one q that cannot mean "prefer this". The function already clamped `-Infinity` to 0, so the two disagreed on the same sign: `-Infinity` sorted last, `-99999` sorted first. Each side now clamps to the bound it is past, which is what the `Infinity` branch was already doing for the top end. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * remove the unnecessary change ---------
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Trailers
- Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
- Co-authored-by: Yusuke Wada <yusuke@kamawada.com>
Diff stats
2 files+26 added−7 removed
- tests:+20 added−1 removed
- other:+6 added−6 removed