Skip to content

Add user agent when default_user_agent_disabled is false#123

Merged
3dgiordano merged 1 commit into
developmentfrom
UA-BZM-HTTP
Jul 10, 2026
Merged

Add user agent when default_user_agent_disabled is false#123
3dgiordano merged 1 commit into
developmentfrom
UA-BZM-HTTP

Conversation

@3dgiordano

Copy link
Copy Markdown
Collaborator

This pull request enhances how the HTTP/2 plugin sets the User-Agent header by introducing logic to add a default User-Agent when none is configured, unless explicitly disabled via a property. It also adds comprehensive tests to verify this behavior, ensuring compatibility with legacy behavior and configurability.

User-Agent header handling improvements:

  • Added logic in JmeterRequestHeadersSupport to automatically set a default User-Agent header ("BlazeMeter HTTP" or "BlazeMeter HTTP/<version>") if none is provided, unless the httpclient4.default_user_agent_disabled property is set to true. This matches the legacy behavior of HTTPHC4Impl and improves interoperability. [1] [2]
  • Introduced helper methods and constants in JmeterRequestHeadersSupport to support the new default User-Agent logic, including property checks and default value construction. [1] [2]

Testing enhancements:

  • Added new tests in JmeterRequestHeadersSupportTest to verify that the default User-Agent is set when missing, not overridden if already present (including empty values), and omitted when the disabling property is set.
  • Improved test setup and teardown by clearing the relevant property after each test to avoid side effects.

Dependency and import updates:

  • Added necessary imports for JMeterUtils, StringUtils, and test utilities to support the new logic and tests. [1] [2]

@3dgiordano 3dgiordano merged commit 9057a4b into development Jul 10, 2026
1 check passed
@3dgiordano 3dgiordano deleted the UA-BZM-HTTP branch July 10, 2026 18:44
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

Successfully merging this pull request may close these issues.

2 participants