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

Better default user agent for http requests #3407

Open
ash211 opened this issue Nov 14, 2024 · 2 comments
Open

Better default user agent for http requests #3407

ash211 opened this issue Nov 14, 2024 · 2 comments

Comments

@ash211
Copy link

ash211 commented Nov 14, 2024

Version info:

Artillery: 2.0.21
Node.js:   v22.9.0
OS:        darwin

Running this command with an http request configured:

artillery run artillery-load-test.yml

I expected to see requests in my logs a request with a user agent that says something about artillery, like this: Artillery/2.0.21 Node.js/v22.9.0 darwin

Instead the default user agent is got (https://github.com/sindresorhus/got)

For reference, Apache Bench's user agent is ApacheBench/2.3

Files being used:

An example with an http request is the sample

@hassy
Copy link
Member

hassy commented Nov 15, 2024

That's odd. The default user-agent header is set to Artillery (https://artillery.io) here:

https://github.com/artilleryio/artillery/blob/main/packages/core/lib/engine_http.js#L441

Just verified it with:

nc -l 10111
artillery quick http://127.0.0.1:10111/
❯ nc -l 10111
GET / HTTP/1.1
user-agent: Artillery (https://artillery.io)
accept-encoding: gzip, deflate, br
Host: 127.0.0.1:10111
Connection: keep-alive

@ash211
Copy link
Author

ash211 commented Nov 15, 2024

Hmm, maybe it has something to do with the default headers settings in my artillery-load-test.yml?

  defaults:
    headers:
      accept: 'application/json'
      accept-language: 'en-US,en;q=0.9'
      authorization: 'Bearer {{ $env.TOKEN }}'
      content-type: 'application/json'
      cookie: 'TOKEN={{ $env.TOKEN }}'
      origin: 'https://mydomain.com'
      priority: 'u=1, i'

Hypothesis: when you set default headers, you lose the default artillery user agent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants