File tree Expand file tree Collapse file tree 2 files changed +6
-1
lines changed
Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -114,7 +114,11 @@ function keysSorter(input) {
114114}
115115
116116exports . extract = function ( str ) {
117- return str . split ( '?' ) [ 1 ] || '' ;
117+ var queryStart = str . indexOf ( '?' ) ;
118+ if ( queryStart === - 1 ) {
119+ return '' ;
120+ }
121+ return str . slice ( queryStart + 1 ) ;
118122} ;
119123
120124exports . parse = function ( str , opts ) {
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import fn from '../';
44test ( 'should extract query string from url' , t => {
55 t . is ( fn . extract ( 'http://foo.bar/?abc=def&hij=klm' ) , 'abc=def&hij=klm' ) ;
66 t . is ( fn . extract ( 'http://foo.bar/?' ) , '' ) ;
7+ t . is ( fn . extract ( 'http://foo.bar/?regex=ab?c' ) , 'regex=ab?c' ) ;
78} ) ;
89
910test ( 'should handle strings not containing query string' , t => {
You can’t perform that action at this time.
0 commit comments