Skip to content

HttpClientBuilder: honor disableDefaultUserAgent() - #931

Merged
arturobernalg merged 1 commit into
apache:masterfrom
arturobernalg:fix-default-user-agent
Nov 14, 2026
Merged

arturobernalg merged 1 commit into
apache:masterfrom
arturobernalg:fix-default-user-agent

Conversation

@arturobernalg

Copy link
Copy Markdown
Member

The defaultUserAgentDisabled guard was dropped together with the http.agent system property support, so the builder set the default User-Agent header regardless of disableDefaultUserAgent().

@arturobernalg
arturobernalg requested a review from ok2c November 7, 2026 11:21
@ok2c

ok2c commented Nov 7, 2026

Copy link
Copy Markdown
Member

@arturobernalg HttpAsyncClientBuilder does not have this option. I suggest we deprecate it HttpClientBuilder as well and make it no-op.

@arturobernalg
arturobernalg force-pushed the fix-default-user-agent branch from 2d1d276 to 6a5db3a Compare November 7, 2026 13:33
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

class TestHttpClientBuilderUserAgent extends AbstractIntegrationTestBase {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@arturobernalg Drop this test class. It is not worth it.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Done

…no-op

The option has had no effect since the default User-Agent guard was dropped
together with the http.agent system property support, and the async builders
do not have it. The method is now deprecated and ignored.
@arturobernalg
arturobernalg merged commit 724cf00 into apache:master Nov 14, 2026
11 of 12 checks passed
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