File tree 2 files changed +7
-4
lines changed
2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -145,16 +145,18 @@ function parse(str, options) {
145
145
146
146
function startIndex ( str , index , max ) {
147
147
do {
148
- if ( str . charCodeAt ( index ) !== 0x20 /* */ ) break ;
148
+ var code = str . charCodeAt ( index ) ;
149
+ if ( code !== 0x20 /* */ && code !== 0x09 /* \t */ ) return index ;
149
150
} while ( ++ index < max ) ;
150
- return index ;
151
+ return max ;
151
152
}
152
153
153
154
function endIndex ( str , index , min ) {
154
155
while ( index > min ) {
155
- if ( str . charCodeAt ( -- index ) !== 0x20 /* */ ) return index + 1 ;
156
+ var code = str . charCodeAt ( -- index ) ;
157
+ if ( code !== 0x20 /* */ && code !== 0x09 /* \t */ ) return index + 1 ;
156
158
}
157
- return index ;
159
+ return min ;
158
160
}
159
161
160
162
/**
Original file line number Diff line number Diff line change @@ -46,6 +46,7 @@ describe('cookie.parse(str)', function () {
46
46
assert . deepEqual ( cookie . parse ( ' = bar ' ) , { '' : 'bar' } )
47
47
assert . deepEqual ( cookie . parse ( ' foo = ' ) , { foo : '' } )
48
48
assert . deepEqual ( cookie . parse ( ' = ' ) , { '' : '' } )
49
+ assert . deepEqual ( cookie . parse ( '\tfoo\t=\tbar\t' ) , { foo : 'bar' } )
49
50
} )
50
51
51
52
it ( 'should return original value on escape error' , function ( ) {
You can’t perform that action at this time.
0 commit comments