util: make MIMEParams accessors case-insensitive · nodejs/node@8a07969 · GitHub
Skip to content

Commit 8a07969

Browse files
watildeaduh95
authored andcommitted
util: make MIMEParams accessors case-insensitive
MIME parameter names are case-insensitive and the parser already ASCII-lowercases them, but MIMEParams.get(), has(), delete() and set() compared against the raw argument. As a result a parsed parameter was unreachable by the casing the caller used (e.g. params.get('Charset') returned null for "Charset=utf-8"), and set() could create duplicate, case-colliding parameters. Lowercase the name in the accessors to match the parser, consistent with the whatwg-mimetype reference implementation. Signed-off-by: Daijiro Wachi <daijiro.wachi@gmail.com> PR-URL: #64123 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 21e2420 commit 8a07969

2 files changed

Lines changed: 31 additions & 3 deletions

File tree

lib/internal/mime.js

Lines changed: 4 additions & 3 deletions

test/parallel/test-mime-api.js

Lines changed: 27 additions & 0 deletions

0 commit comments

Comments
 (0)