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

HttpClientFactory not using Symfony http_client options #574

Open
poolerMF opened this issue Nov 21, 2021 · 4 comments
Open

HttpClientFactory not using Symfony http_client options #574

poolerMF opened this issue Nov 21, 2021 · 4 comments

Comments

@poolerMF
Copy link

framework:
    http_client:
        default_options:
            http_version: "1.0"
            max_redirects: 2
            ...

Sentry\HttpClient\HttpClientFactory should use those defined http_client options when creating $httpClient
if not, then using custom HttpClient NEEDS to customizable/easy to define/change

@Jean85
Copy link
Collaborator

Jean85 commented Nov 22, 2021

This should be a nice feature. In any case, it's already possible with the transport_factory option: you need to write a class that implements the TransportFactoryInterface and just returns the already-built client (that probably gets injected with).

@ste93cry do you think we should add a dedicated option? Something like transport: @service that does that for the end user?

@poolerMF
Copy link
Author

poolerMF commented Nov 22, 2021

I think it's not feature .. if sentry want to use symfony http client, then sentry need to support their http_client default_options

For my purposes I made CustomTransportFactoryInterface and CustomHttpClientFactory ... but it tooks me some time to do it and some time to find out, that sentry is not supporting those default client options

another thing is, that I can have SymfonyHttplugClient, GuzzleHttpClient and CurlHttpClient in my project, and there is no easy way to use specific GuzzleHttpClient ... in HttpClientFactory you set up strict order (if exist SymfonyHttplugClient, if exist GuzzleHttpClient, if exist CurlHttpClient)

@Jean85
Copy link
Collaborator

Jean85 commented Nov 22, 2021

As of now, the Symfony client is used as default transport not just by this bundle, but by the whole PHP SDK. Hence, that piece of code doesn't know if it's running in a Symfony app with the whole framework.

So, that's what I'm talking about as a new feature: hooking into the Symfony Framework HTTP client creation.

@github-actions

This comment was marked as off-topic.

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

No branches or pull requests

4 participants