Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User-Agent overriden in Node #69

Closed
terinjokes opened this issue May 5, 2015 · 6 comments
Closed

User-Agent overriden in Node #69

terinjokes opened this issue May 5, 2015 · 6 comments

Comments

@terinjokes
Copy link

When using axios in NodeJS, a custom set User-Agent would be overriden by Axios's default, instead of being applied if a User-Agent isn't already set.

https://github.com/mzabriskie/axios/blob/1629a026da17a1e1d8999a02f3fe6b6b60aaac9c/lib/adapters/http.js#L28-L29

@ralphholzmann
Copy link

Hi friends! Anyway we could get this fix tagged in npm? We need this fix over at Vine, and I would rather not have to peg to a git commit in my package.json.

Thanks :)

@pahund
Copy link

pahund commented Jul 21, 2015

+1, I could really use this fix in my project

@nerdgore
Copy link

+1 We could really use this fix but don't want to (read: can't) fetch directly from github.

@mzabriskie
Copy link
Member

I just released 0.6.0 which includes a fix for this.

@ralphholzmann
Copy link

@mzabriskie thanks so much!

@mrozbarry
Copy link

mrozbarry commented Sep 7, 2017

@mzabriskie this might still be a problem when setting default headers in nodejs.

For my unit tests, I have the following config:

import axios from "axios"

const instance = axios.create()
instance.defaults.headers.common["User-Agent"] = "unit-test"
global.axios = instance

The intent is that I don't want to modify any of my code to conditionally set the user agent.

When I look at my development server, I see the following headers:

{ "accept": "application/json, text/plain, */*",
  "user-agent": "axios/0.16.2",
  "host": "localhost:3000",
  "connection": "close" }

@axios axios locked and limited conversation to collaborators May 21, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants