Skip to content

Commit

Permalink
fixup: update state UA logic
Browse files Browse the repository at this point in the history
Play nice with axios#3703
  • Loading branch information
mastermatt committed Sep 6, 2021
1 parent fac6c3f commit 8843477
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lib/adapters/http.js
Expand Up @@ -60,11 +60,10 @@ module.exports = function httpAdapter(config) {

// Set User-Agent (required by some servers)
// See https://github.com/axios/axios/issues/69
if ('User-Agent' in headers || 'user-agent' in headers) {
if ('user-agent' in headerNames) {
// User-Agent is specified; handle case where no UA header is desired
if (!headers['User-Agent'] && !headers['user-agent']) {
delete headers['User-Agent'];
delete headers['user-agent'];
if (!headers[headerNames['user-agent']]) {
delete headers[headerNames['user-agent']];
}
// Otherwise, use specified value
} else {
Expand Down

0 comments on commit 8843477

Please sign in to comment.