Skip to content

feat: add custom User-Agent header (goperf/<version>)#107

Merged
11eshaannegi merged 2 commits into
mainfrom
feat/custom-user-agent
Mar 26, 2026
Merged

feat: add custom User-Agent header (goperf/<version>)#107
11eshaannegi merged 2 commits into
mainfrom
feat/custom-user-agent

Conversation

@11eshaannegi

Copy link
Copy Markdown
Contributor

Summary
Added a custom User-Agent header (goperf/<version>) to outgoing HTTP requests instead of using Go's default Go-http-client/1.1.


Screenshot 2026-03-26 071432
Screenshot 2026-03-26 065145

Previously, goperf requests used Go's default User-Agent:

Screenshot 2026-03-26 071424

@rajat-tomar rajat-tomar left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Vegeta, k6, ab all set a custom User-Agent for exactly this reason. Fix the duplicate header issue (see inline).

Also needs tests. TestMakeRequestSuccess already sets up an httptest.Server — add a check in the handler for r.Header.Get("User-Agent"). And a case where you pass User-Agent via Headers to verify it overrides cleanly without duplicating.

Comment thread internal/httpclient/client.go Outdated
@11eshaannegi 11eshaannegi merged commit 2ad9fc2 into main Mar 26, 2026
5 checks passed
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 1.11.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants