Skip to content

Commit 5d4afcb

Browse files
committed
add user agent to outgoing requests
1 parent 0ea6f6a commit 5d4afcb

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/lib/api/index.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,19 @@ const handleResponse = async (response: Response): Promise<any> => {
3030

3131
export const get = async (path: string) =>
3232
fetch(new URL(path, BASE_URL).toString(), {
33-
redirect: 'follow'
33+
headers: {
34+
'User-Agent': 'github-actions',
35+
},
36+
redirect: 'follow',
3437
}).then(handleResponse);
3538

3639
export const post = async (path: string, body: any) =>
3740
fetch(new URL(path, BASE_URL).toString(), {
3841
method: 'POST',
39-
redirect: 'follow',
42+
body: JSON.stringify(body),
4043
headers: {
44+
'User-Agent': 'github-actions',
4145
'Content-Type': 'application/json'
4246
},
43-
body: JSON.stringify(body)
47+
redirect: 'follow',
4448
}).then(handleResponse);

0 commit comments

Comments
 (0)