[DOCS][Dev] Add HTTP Client

This commit is contained in:
Diogo Peralta Cordeiro 2021-08-03 18:22:37 +01:00 committed by Hugo Sales
parent c99e447308
commit 7b6a44cfbb
Signed by: someonewithpc
GPG Key ID: 7D0C7EAFC9D835A0
3 changed files with 12 additions and 1 deletions

View File

@ -13,7 +13,7 @@
- [Queue](./queue.md)
- [Attachments, Files and Thumbnails](./attachments.md)
- [Security](./security.md)
- [HTTP](./http.md)
- [HTTP Client](./httpclient.md)
- [Plugins](./plugins.md)
- [Configuration](./plugins/configuration.md)
- [Initialization and Clean Up](./plugins/lifetime.md)

View File

@ -0,0 +1,11 @@
# HTTP Client
It is sometimes necessary to perform HTTP requests. We simply have a static wrapper
around [Symfony HTTP](https://symfony.com/doc/current/http_client.html#basic-usage).
You can do `App\Core\HTTPClient::{METHOD}(string: $url, array: $options): ResponseInterface`.
The `$options` are elaborated in [Symfony Doc](https://symfony.com/doc/current/http_client.html#configuring-curlhttpclient-options).
Please note that the HTTP Client is [lazy](https://en.wikipedia.org/wiki/Lazy_evaluation),
which makes it very important to bear in mind [Network Errors](https://symfony.com/doc/current/http_client.html#dealing-with-network-errors),
What you can take from Responses is specified [here](https://symfony.com/doc/current/http_client.html#processing-responses).