Skip to content

Commit ee73673

Browse files
authored
Add HTAB as optional whitespace (#77)
1 parent 5b86bac commit ee73673

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ function parseTokenList (str) {
114114
// gather tokens
115115
for (var i = 0, len = str.length; i < len; i++) {
116116
switch (str.charCodeAt(i)) {
117+
case 0x09: /* HTAB */
117118
case 0x20: /* */
118119
if (start === end) {
119120
start = end = i + 1

test/fresh.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ describe('fresh(reqHeaders, resHeaders)', function () {
3434
var resHeaders = { etag: '"foo"' }
3535
assert.ok(fresh(reqHeaders, resHeaders))
3636
})
37+
38+
it('should be fresh when the list is separated with tabs', function () {
39+
var reqHeaders = { 'if-none-match': '"bar",\t"foo"' }
40+
var resHeaders = { etag: '"foo"' }
41+
assert.ok(fresh(reqHeaders, resHeaders))
42+
})
3743
})
3844

3945
describe('when etag is missing', function () {

0 commit comments

Comments
 (0)