-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
[HttpClient] Providing additional options to CurlHttpClient section #14195
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
Conversation
…to CurlHttpClient (pizzaminded) This PR was squashed before being merged into the 5.2-dev branch. Discussion ---------- [HttpClient] Allow to provide additional curl options to CurlHttpClient | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | Deprecations? | no | Tickets | Fix #37798 | License | MIT | Doc PR | symfony/symfony-docs#14195 ~~**Tagging as a draft because:**~~ - ~~there is no Doc PR Ready yet~~ - probably there are better test cases required here. This PR introduces an option to override default curl options defined in `CurlHttpClient`. To override them, there is a special place in `$options` provided: ````php $response = $httpClient->request('GET', 'http://your.url.here', [ 'extra' => [ 'curl' => [ CURLOPT_IPRESOLVE => CURL_IPRESOLVE_V4, ] ] ]); ```` This feature is available only in `CurlHttpClient` and would be ignored in another clients. Commits ------- 89329bd [HttpClient] Allow to provide additional curl options to CurlHttpClient
http_client.rst
Outdated
@@ -728,6 +728,39 @@ When using this component in a full-stack Symfony application, this behavior is | |||
not configurable and cURL will be used automatically if the cURL PHP extension | |||
is installed and enabled. Otherwise, the native PHP streams will be used. | |||
|
|||
Providing additional options to CurlHttpClient |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Additional Options ...
Uppercase letters. Thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed.
http_client.rst
Outdated
Providing additional options to CurlHttpClient | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
It is possible to provide additional cURL options to CurlHttpClient. PHP exposes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CurlHttpClient in backticks please
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed.
http_client.rst
Outdated
|
||
It is possible to provide additional cURL options to CurlHttpClient. PHP exposes | ||
a lot of `cURL options`_ that can be passed to ``curl_setopt`` function, but only some | ||
of them are used in CurlHttpClient in favor of bigger component portability. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed.
http_client.rst
Outdated
// ... | ||
'extra' => [ | ||
'curl' => [ | ||
\CURLOPT_IPRESOLVE => \CURL_IPRESOLVE_V6 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO we can remove the leading slashes to keep the example easier to read
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed.
e24a939
to
729c7df
Compare
Mikolaj, thanks and congrats on your first Symfony Docs contribution! It was a fantastic first-time contribution, but we made some minor rewords to make the new contents more similar to the existing contents (but we kept most of your original contribution). |
Documentation for symfony/symfony#38026 PR.