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

HTTPClient.configuration should expose the configuration set #774

Open
weissi opened this issue Sep 24, 2024 · 4 comments
Open

HTTPClient.configuration should expose the configuration set #774

weissi opened this issue Sep 24, 2024 · 4 comments

Comments

@weissi
Copy link
Contributor

weissi commented Sep 24, 2024

For some reason, HTTPClient hides the configuration that was used to configure it from the user. We shouldn't do that.

@MartinLau7
Copy link

I agree with @weissi 's point of view. Since the configuration of HTTPClient.shared is currently hidden, it is impossible to modify certain properties of configuration when using .shared. Was this intentional by design? I want to restrict redirects for HTTP status 302, but this limitation forces me to abandon .shared, which is quite frustrating.

@weissi
Copy link
Contributor Author

weissi commented Jan 10, 2025

I agree with @weissi 's point of view. Since the configuration of HTTPClient.shared is currently hidden, it is impossible to modify certain properties of configuration when using .shared. Was this intentional by design? I want to restrict redirects for HTTP status 302, but this limitation forces me to abandon .shared, which is quite frustrating.

So it is by design that it won't let you modify the global config (that'd be dangerous as it's shared) but of course it's bad that it has important global config. The fix to this is #392 .

A separate bug (the one I filed here) is that AHC currently doesn't even let you read the configuration it has :|...

@MartinLau7
Copy link

In addition to allowing global configuration to be readable, I believe the global configuration for HTTPClient should not include redirectConfiguration and decompression. Alternatively, it should allow modifications to redirectConfiguration and decompression on a per-request basis.

@weissi
Copy link
Contributor Author

weissi commented Jan 10, 2025

In addition to allowing global configuration to be readable, I believe the global configuration for HTTPClient should not include redirectConfiguration and decompression. Alternatively, it should allow modifications to redirectConfiguration and decompression on a per-request basis.

Agreed, I don't see a reason to have any global-only configuration. Everything that's configurable globally only means people need to migrate from HTTPClient.shared and then they're immediately forced to manage manual lifecycles (or incur performance overheads constantly starting/stopping HTTPClients which throws away the connection pool and TLSContext).

FWIW, that's pretty what #392 proposes.

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