Skip to content

adjust to final clients #244

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
Dec 25, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion components/client-common.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ To be able to do that, it also wraps a message factory::
$bar = $client->get('http://example.com/bar', ['accept-encoding' => 'application/json']);
$post = $client->post('http://example.com/update', [], 'My post body');

..versionadded:: 2.0
``HttpMethodsClient`` is final since version 2.0. You can typehint the
``HttpMethodsClientInterface`` to allow mocking the client in unit tests.

BatchClient
-----------

Expand All @@ -48,6 +52,10 @@ their responses as a ``BatchResult``::

$batchResult = $client->sendRequests($requests);

..versionadded:: 2.0
``BatchClient`` is final since version 2.0. You can typehint the
``BatchClientInterface`` to allow mocking the client in unit tests.

The ``BatchResult`` itself is an object that contains responses for all requests sent.
It provides methods that give appropriate information based on a given request::

Expand Down Expand Up @@ -123,7 +131,7 @@ To enable the behavior, wrap the clients with the ``HttpClientPoolItem`` class y
// Never reactivate the client (default)
$httpClientPool->addHttpClient(new HttpClientPoolItem($httpClient, null));

``HttpClientPool`` is abstract. There are three concrete implementations with specific strategies on how to choose clients:
``HttpClientPool`` is an interface. There are three concrete implementations with specific strategies on how to choose clients:

LeastUsedClientPool
*******************
Expand Down Expand Up @@ -228,3 +236,7 @@ and also to download an image from a static host::
it's easier to use the ``RequestConditionalPlugin`` and the ``PluginClient``,
but in that case the routing logic is integrated into the linear request flow
which might make debugging harder.

..versionadded:: 2.0
``HttpClientRouter`` is final since version 2.0. You can typehint the
``HttpClientRouterInterface`` to allow mocking the client in unit tests.
4 changes: 2 additions & 2 deletions integrations/symfony-bundle.rst
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ Plugins
```````

Clients can have plugins that act on the request before it is sent out and/or
on the response before it is returned to the caller. Generic plugins from
on the response before it is returned to the caller. Generic plugins from
``php-http/client-common`` (e.g. retry or redirect) can be configured globally.
You can tell the client which of those plugins to use, as well as specify the
service names of custom plugins that you want to use.
Expand Down Expand Up @@ -322,7 +322,7 @@ Special HTTP Clients
````````````````````

If you want to use the ``FlexibleHttpClient`` or ``HttpMethodsClient`` from the
``php-http/message`` package you may specify that on the client configuration.
``php-http/client-common`` package, you may specify that on the client configuration.

.. code-block:: yaml

Expand Down