Skip to content

Commit

Permalink
fix(api): add user-agent to request. (#116)
Browse files Browse the repository at this point in the history
  • Loading branch information
alfg authored Apr 18, 2023
1 parent e9435cd commit cc3188f
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion api/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "overwatch-api",
"version": "0.12.0",
"version": "0.13.0",
"description": "An Unoffical Overwatch API.",
"main": "lib/index.js",
"typings": "index.d.ts",
Expand Down
4 changes: 4 additions & 0 deletions api/src/parser/profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,13 @@ const MAX_RETRIES = 3;
// Get HTML from playoverwatch career page.
function getHTML(platform, region, tag, callback) {
const url = `https://overwatch.blizzard.com/en-us/career/${tag}/`
const ua = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:112.0) Gecko/20100101 Firefox/112.0';

const options = {
uri: encodeURI(url),
headers: {
'User-Agent': ua,
},
encoding: 'utf8'
}
return retryRequest(options, MAX_RETRIES, callback);
Expand Down
4 changes: 4 additions & 0 deletions api/src/parser/stats.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,13 @@ const MAX_RETRIES = 3;
// Get HTML from playoverwatch career page.
function getHTML(platform, region, tag, callback) {
const url = `https://overwatch.blizzard.com/en-us/career/${tag}/`
const ua = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:112.0) Gecko/20100101 Firefox/112.0';

const options = {
uri: encodeURI(url),
headers: {
'User-Agent': ua,
},
encoding: 'utf8'
}
return retryRequest(options, MAX_RETRIES, callback);
Expand Down

0 comments on commit cc3188f

Please sign in to comment.