File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -9,14 +9,14 @@ const {advanceDateToSkipBadDataIfNecessary} = require('../bad-ranges');
99const RUNS_API = 'https://wpt.fyi/api/runs' ;
1010
1111function apiURL ( options = { } ) {
12- const queryParts = Object . entries ( options ) . map ( ( [ name , value ] ) => {
12+ const url = new URL ( RUNS_API ) ;
13+ for ( let [ name , value ] of Object . entries ( options ) ) {
1314 if ( Array . isArray ( value ) ) {
1415 value = value . join ( ',' ) ;
1516 }
16- return `${ encodeURIComponent ( name ) } =${ encodeURIComponent ( value ) } ` ;
17- } ) ;
18- const query = queryParts . join ( '&' ) ;
19- return `${ RUNS_API } ?${ query } ` ;
17+ url . searchParams . set ( name , value ) ;
18+ }
19+ return url ;
2020}
2121
2222async function get ( options ) {
@@ -64,7 +64,8 @@ async function* getIterator(options) {
6464 break ;
6565 }
6666 previousUrl = url ;
67- url = `${ RUNS_API } ?page=${ token } ` ;
67+ url = new URL ( RUNS_API ) ;
68+ url . searchParams . set ( 'page' , token ) ;
6869 }
6970}
7071
You can’t perform that action at this time.
0 commit comments