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');
9
9
const RUNS_API = 'https://wpt.fyi/api/runs' ;
10
10
11
11
function 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 ) ) {
13
14
if ( Array . isArray ( value ) ) {
14
15
value = value . join ( ',' ) ;
15
16
}
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 ;
20
20
}
21
21
22
22
async function get ( options ) {
@@ -64,7 +64,8 @@ async function* getIterator(options) {
64
64
break ;
65
65
}
66
66
previousUrl = url ;
67
- url = `${ RUNS_API } ?page=${ token } ` ;
67
+ url = new URL ( RUNS_API ) ;
68
+ url . searchParams . set ( 'page' , token ) ;
68
69
}
69
70
}
70
71
You can’t perform that action at this time.
0 commit comments