taxjar / taxjar-node

Sales Tax API Client for Node
https://developers.taxjar.com/api/reference/?javascript
MIT License
54 stars 24 forks source link

Add a custom user agent string to each request #52

Closed ScottRudiger closed 4 years ago

ScottRudiger commented 4 years ago

To help debug technical issues, it's necessary to collect additional information about a user's server.

For that purpose, this PR adds a custom user agent string to each request, which includes the following information:

Example UA string:

Screen Shot 2020-03-19 at 8 54 11 AM
ScottRudiger commented 4 years ago

@ScottRudiger Can we check for TypeScript? Do we need to encode any of these values? Can you write up a spec or two to ensure valid formatting? You may have to refactor this into a method to pass a mocked object.

@fastdivision I haven't found a way to programmatically determine if a user is utilizing TypeScript yet. In Stripe, it appears typescript is a user-defined Boolean during instantiation. I don't believe we need to encode any values in the user agent based on research here and here.

A test to ensure we're including appropriate headers has been added since your initial review.