Skip to content

Commit

Permalink
add x-forwarded-for header for alphavantage client
Browse files Browse the repository at this point in the history
  • Loading branch information
kiriltaran committed Feb 19, 2020
1 parent 1e0ab43 commit 055d6b0
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/services/alphavantage/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ const alphavantageApiClient = axios.create(config);

alphavantageApiClient.interceptors.request.use(request => ({
...request,
headers: {
"X-Forwarded-For": `${Math.floor(Math.random() * 255) + 1}.${Math.floor(
Math.random() * 255
) + 0}.${Math.floor(Math.random() * 255) + 0}.${Math.floor(
Math.random() * 255
) + 0}`
},
params: {
apikey: process.env.ALPHAVANTAGE_API_KEY || "OKC0BT76URCJ1QBU"
}
Expand Down

0 comments on commit 055d6b0

Please sign in to comment.