Commit 329913c
fix: throw error when Content-Type is invalid
When calling res.set('Content-Type', value) where value is not a valid
MIME type (e.g., 'some-custom-type'), mime.contentType() returns false.
Previously, this false value was coerced to the string "false" and set
as the Content-Type header.
This change throws a TypeError when mime.contentType() returns false,
making the error explicit and easier to catch. This behavior aligns
with the existing TypeError thrown for Array values.
Fixes #7034
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>1 parent 9c85a25 commit 329913c
1 file changed
Lines changed: 5 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
673 | 673 | | |
674 | 674 | | |
675 | 675 | | |
676 | | - | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
677 | 681 | | |
678 | 682 | | |
679 | 683 | | |
| |||
0 commit comments