Skip to content

Commit cc3188f

Browse files
authored
fix(api): add user-agent to request. (#116)
1 parent e9435cd commit cc3188f

File tree

4 files changed

+10
-2
lines changed

4 files changed

+10
-2
lines changed

api/package-lock.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "overwatch-api",
3-
"version": "0.12.0",
3+
"version": "0.13.0",
44
"description": "An Unoffical Overwatch API.",
55
"main": "lib/index.js",
66
"typings": "index.d.ts",

api/src/parser/profile.js

+4
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,13 @@ const MAX_RETRIES = 3;
77
// Get HTML from playoverwatch career page.
88
function getHTML(platform, region, tag, callback) {
99
const url = `https://overwatch.blizzard.com/en-us/career/${tag}/`
10+
const ua = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:112.0) Gecko/20100101 Firefox/112.0';
1011

1112
const options = {
1213
uri: encodeURI(url),
14+
headers: {
15+
'User-Agent': ua,
16+
},
1317
encoding: 'utf8'
1418
}
1519
return retryRequest(options, MAX_RETRIES, callback);

api/src/parser/stats.js

+4
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,13 @@ const MAX_RETRIES = 3;
77
// Get HTML from playoverwatch career page.
88
function getHTML(platform, region, tag, callback) {
99
const url = `https://overwatch.blizzard.com/en-us/career/${tag}/`
10+
const ua = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:112.0) Gecko/20100101 Firefox/112.0';
1011

1112
const options = {
1213
uri: encodeURI(url),
14+
headers: {
15+
'User-Agent': ua,
16+
},
1317
encoding: 'utf8'
1418
}
1519
return retryRequest(options, MAX_RETRIES, callback);

0 commit comments

Comments
 (0)