From edde62fd4b444e4c9f469abec860915ced14b673 Mon Sep 17 00:00:00 2001 From: Blake Embrey Date: Tue, 27 Jan 2026 14:55:35 -0800 Subject: [PATCH] Add test for HTAB --- test/contentType_parse.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/test/contentType_parse.js b/test/contentType_parse.js index 1609417..6696394 100644 --- a/test/contentType_parse.js +++ b/test/contentType_parse.js @@ -51,6 +51,24 @@ describe('contentType.parse(string)', function () { })) }) + it('should parse parameters with HTAB LWS', function () { + var type = contentType.parse('text/html;\tcharset=utf-8;\tfoo=bar') + assert.strictEqual(type.type, 'text/html') + assert.ok(deepEqual(type.parameters, { + charset: 'utf-8', + foo: 'bar' + })) + }) + + it('should parse parameters with mixed LWS', function () { + var type = contentType.parse('text/html ;\t charset=utf-8 ; \tfoo=bar') + assert.strictEqual(type.type, 'text/html') + assert.ok(deepEqual(type.parameters, { + charset: 'utf-8', + foo: 'bar' + })) + }) + it('should lower-case type', function () { var type = contentType.parse('IMAGE/SVG+XML') assert.strictEqual(type.type, 'image/svg+xml')