Skip to content

Commit

Permalink
Dont set User-Agent header in browser (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
dmoss18 authored Feb 28, 2024
1 parent 0b00592 commit e9268ea
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions lib/services/tastytrade-http-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,18 @@ export default class TastytradeHttpClient{
}

private getDefaultHeaders(): any {
return {
"Content-Type": "application/json",
"Accept": "application/json",
"Authorization": this.session.authToken,
"User-Agent": 'tastytrade-sdk-js'
};
const headers: { [key: string]: any } = {
"Content-Type": "application/json",
"Accept": "application/json",
"Authorization": this.session.authToken
};

// Only set user agent if running in node
if (typeof window === 'undefined') {
headers["User-Agent"] = 'tastytrade-sdk-js'
}

headers
}

private async executeRequest(method: string, url: string, data: object = {}, headers: object = {}, params: object = {}) {
Expand Down

0 comments on commit e9268ea

Please sign in to comment.