Closed gurpreetatwal closed 6 years ago
@gurpreetatwal Any reason why we're choosing to use :
instead of /
. Seems like other api's are using /
. https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/User-Agent#Syntax
Thoughts on:
`Smartcar/${pkg.version} (${process.platform}; ${process.arch}) Node.js ${process.version} `
'Smartcar/4.0.1 (Linux; x64) Node.js 6.14.3'
/^Smartcar\/(\d+\.\d+\.\d+) \((\w+); (\w+)\) Node.js (\d+\.\d+\.\d+)$/
/^Smartcar\/(\d+\.\d+\.\d+-[\w-]*) \((\w+); (\w+)\) Node.js (v\d+\.\d+\.\d+)$/
need to include any specifiers after version like 3.0.0-rc1
@gurpreetatwal do you need the specifiers for the process version as well?
lgtm, just address @sankethkatta's remarks :rocket:
mr. realtime ;)
@sankethkatta at least for Node, I don't think so
Fixes the
user-agent
header so that it reports the version of the client making the request as opposed to Smartcar API being accessed (which is in the URL) as it currently does.I also added in the version of node.js that the request was made from for tracking of which node version we should support. Please take a close look at the format of the header as well as if we should be including more or less information in it. (first glance
process.platform
might be useful for windows/osx/linux support)Format:
smartcar-node-sdk:<pkg-version> (node.js <node-version>)
Example:smartcar-node-sdk:3.0.2 (node.js v6.14.3)
Examples of headers from other API libraries:
sendgrid/<pkg-version>;nodejs
twilio-node/<pkg-version> (node.js <node-version>)
Plaid Node v<pkg-version>
Lob/v1 NodeBindings/<pkg-version>
PayPalSDK/PayPal-node-SDK <pkg-version> (node <node-version>-${process.arch}-${process.platform}; OpenSSL ${process.versions.openssl}
aws-sdk-nodejs/<pkg-version> ${process.platform}/<node-version>