Skip to content

[HttpClient] Service name #11648

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

Merged
merged 1 commit into from
Jun 3, 2019
Merged

[HttpClient] Service name #11648

merged 1 commit into from
Jun 3, 2019

Conversation

Guikingone
Copy link
Contributor

@Guikingone Guikingone commented Jun 3, 2019

Hi everyone 👋

I've tried to use multiples clients and it seems that the services are named as the configuration (ex: @crawler.client) declares it and not using the @http_client.client syntax, I don't know if it's a normal behaviour or just an error on the documentation 🙁

Thanks for the feedback

@javiereguiluz
Copy link
Member

@Guikingone the current docs were contributed/reviewed by @nicolas-grekas, so they are probably right. Maybe it's a bug in the code that doesn't generate the intended service names?

@Guikingone
Copy link
Contributor Author

Guikingone commented Jun 3, 2019

@javiereguiluz Yes, I think that @nicolas-grekas is right, here's the configuration that cause this case:

framework:
    secret: '%env(APP_SECRET)%'
    session:
        handler_id: ~
        cookie_secure: auto
        cookie_samesite: lax
    php_errors:
        log: true
    http_client:
        scoped_clients:
            github.client:
                base_uri: '%env(OAUTH_GITHUB_API_URL)%'
                http_version: '2.0'

Here's the container dump:

    <service id="github.client" class="Symfony\Component\HttpClient\ScopingHttpClient">
      <argument type="service" id="http_client"/>
      <argument>%env(OAUTH_GITHUB_API_URL)%</argument>
      <argument type="collection">
        <argument key="base_uri">%env(OAUTH_GITHUB_API_URL)%</argument>
        <argument key="http_version">2.0</argument>
        <argument key="query" type="collection"/>
        <argument key="headers" type="collection"/>
        <argument key="resolve" type="collection"/>
      </argument>
      <factory class="Symfony\Component\HttpClient\ScopingHttpClient" method="forBaseUri"/>
    </service>

I've searched for http_client.github but nothing :/

@OskarStark OskarStark added the bug label Jun 3, 2019
@javiereguiluz
Copy link
Member

Thank you Guillaume.

@javiereguiluz javiereguiluz merged commit 0f4f64e into symfony:4.3 Jun 3, 2019
javiereguiluz added a commit that referenced this pull request Jun 3, 2019
This PR was merged into the 4.3 branch.

Discussion
----------

[HttpClient] Service name

Hi everyone 👋

I've tried to use multiples clients and it seems that the services are named as the configuration (ex: `@crawler.client`) declares it and not using the `@http_client.client` syntax, I don't know if it's a normal behaviour or just an error on the documentation 🙁

Thanks for the feedback

Commits
-------

0f4f64e fix(DI): service name
@Guikingone Guikingone deleted the patch-22 branch June 3, 2019 08:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants