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

Comments

@terinjokes
Copy link

commented May 5, 2015

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

This comment has been minimized.

Copy link

commented Jul 13, 2015

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

This comment has been minimized.

Copy link

commented Jul 21, 2015

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

@nerdgore

This comment has been minimized.

Copy link

commented Jul 21, 2015

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

@mzabriskie

This comment has been minimized.

Copy link
Member

commented Sep 21, 2015

I just released 0.6.0 which includes a fix for this.

@ralphholzmann

This comment has been minimized.

Copy link

commented Sep 22, 2015

@mzabriskie thanks so much!

@mrozbarry

This comment has been minimized.

Copy link

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" }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants
You can’t perform that action at this time.