mirror of
https://github.com/expressjs/express.git
synced 2026-02-21 19:41:36 +00:00
test: add test for normalizeType fallback when mime lookup fails (#6894)
Add test to verify that utils.normalizeType correctly defaults to 'application/octet-stream' when mime.lookup() returns null/undefined for unknown file extensions. This covers the fallback behavior on line 64 of lib/utils.js and ensures proper handling of unrecognized MIME types. Co-authored-by: bjohansebas <103585995+bjohansebas@users.noreply.github.com>
This commit is contained in:
@@ -35,8 +35,15 @@ describe('utils.normalizeType acceptParams method', () => {
|
||||
params: {} // No parameters are added since "invalid" has no "="
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('should default to application/octet-stream when mime lookup fails', () => {
|
||||
const result = utils.normalizeType('unknown-extension-xyz');
|
||||
assert.deepEqual(result, {
|
||||
value: 'application/octet-stream',
|
||||
params: {}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('utils.setCharset(type, charset)', function () {
|
||||
it('should do anything without type', function () {
|
||||
|
||||
Reference in New Issue
Block a user