Issue Summary
with the change from request to axios, the outgoing requests have now 2 user agent headers:
'User-agent': 'sendgrid/7.0.0;nodejs'
'User-Agent': 'axios/0.19.2'
this makes our testing with nock fail, because it tries to lower-case all headers and breaks when there is a conflict.
Steps to Reproduce
- create a mock server to receive requests made with the sdk
- inspect any incoming request header
Code Snippet
sendgrid adds the user agent header with uppercase "U" and lowercase "a"
|
'User-agent': 'sendgrid/' + pkg.version + ';nodejs', |
but axios just checks for the header with "u" + "a" or "U" + "A"
https://github.com/axios/axios/blob/42eb9dfabc85ed029462da1c503f8b414b08ffd0/lib/adapters/http.js#L34
if (!headers['User-Agent'] && !headers['user-agent']) {
Exception/Log
the resulting request has both headers:
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
'User-agent': 'sendgrid/7.0.0;nodejs',
Authorization: 'Bearer SG.fakeKey',
'User-Agent': 'axios/0.19.2',
'Content-Length': 360
}
Technical details:
- sendgrid-nodejs version: 7.0.0
- node version: 12.13.1
Issue Summary
with the change from
requesttoaxios, the outgoing requests have now 2 user agent headers:'User-agent': 'sendgrid/7.0.0;nodejs''User-Agent': 'axios/0.19.2'this makes our testing with
nockfail, because it tries to lower-case all headers and breaks when there is a conflict.Steps to Reproduce
Code Snippet
sendgrid adds the user agent header with uppercase "U" and lowercase "a"
sendgrid-nodejs/packages/client/src/classes/client.js
Line 23 in ae1148c
but axios just checks for the header with "u" + "a" or "U" + "A"
https://github.com/axios/axios/blob/42eb9dfabc85ed029462da1c503f8b414b08ffd0/lib/adapters/http.js#L34
Exception/Log
the resulting request has both headers:
Technical details: