File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -14,11 +14,21 @@ async function parseResponseBody(response: Response): Promise<unknown> {
14
14
return response . text ( ) ;
15
15
}
16
16
17
+ export function buildUrl ( baseUrl : string , params : Record < string , string | number | undefined > ) : string {
18
+ const url = new URL ( baseUrl ) ;
19
+ Object . entries ( params ) . forEach ( ( [ key , value ] ) => {
20
+ if ( value !== undefined ) {
21
+ url . searchParams . append ( key , value . toString ( ) ) ;
22
+ }
23
+ } ) ;
24
+ return url . toString ( ) ;
25
+ }
26
+
17
27
export async function githubRequest (
18
28
url : string ,
19
29
options : RequestOptions = { }
20
30
) : Promise < unknown > {
21
- const headers = {
31
+ const headers : Record < string , string > = {
22
32
"Accept" : "application/vnd.github.v3+json" ,
23
33
"Content-Type" : "application/json" ,
24
34
...options . headers ,
You can’t perform that action at this time.
0 commit comments