-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
[HttpClient] Add buffer configuration option to http_client #12043
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
In PR 32565, a regex value was added as a check to automatically buffer the content of a call
…th a Closure (rjwebdev) This PR was merged into the 4.4 branch. Discussion ---------- [HttpClient] Allow enabling buffering conditionally with a Closure | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #31883 | License | MIT | Doc PR | symfony/symfony-docs#12043 With this PR, responses can be buffered automatically from a closure passed to the `buffer` option. ```php $resp = $client->request('GET', $url, [ 'buffer' => function (array $headers): bool { return true/false; }, ]); ``` When no option is provided, buffering is now enabled only for json, xml and text/* content types. Commits ------- f705ac9 [HttpClient] Allow enabling buffering conditionally with a Closure
…th a Closure (rjwebdev) This PR was merged into the 4.4 branch. Discussion ---------- [HttpClient] Allow enabling buffering conditionally with a Closure | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #31883 | License | MIT | Doc PR | symfony/symfony-docs#12043 With this PR, responses can be buffered automatically from a closure passed to the `buffer` option. ```php $resp = $client->request('GET', $url, [ 'buffer' => function (array $headers): bool { return true/false; }, ]); ``` When no option is provided, buffering is now enabled only for json, xml and text/* content types. Commits ------- f705ac9dc4 [HttpClient] Allow enabling buffering conditionally with a Closure
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.
just a minor comment
**type**: ``bool`` | ``string`` | ||
|
||
Option that allows to buffer the content of the response and access it multiple times without performing the request again. | ||
If boolean value given, request will be buffered or not according to the boolean value. If a string is given, this should |
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.
If boolean value given, request will be buffered or not according to the boolean value. If a string is given, this should | |
If a boolean value is given, the request will be buffered or not according to the boolean value. If a string is given, this should |
|
||
Option that allows to buffer the content of the response and access it multiple times without performing the request again. | ||
If boolean value given, request will be buffered or not according to the boolean value. If a string is given, this should | ||
be a regex matching the response content-types that |
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.
be a regex matching the response content-types that | |
be a regex matching the response content-types that should be buffered. |
Option that allows to buffer the content of the response and access it multiple times without performing the request again. | ||
If boolean value given, request will be buffered or not according to the boolean value. If a string is given, this should | ||
be a regex matching the response content-types that | ||
should be buffered |
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.
should be buffered |
…ttp_client (rjwebdev) This PR was merged into the 4.4 branch. Discussion ---------- [HttpClient] Add buffer configuration option to http_client In PR symfony/symfony#32565, a regex value was added as a check to automatically buffer the content of a call. Since this is a new feature, the documentation of the http_client configuration true frameworkbundle is updated <!-- If your pull request fixes a BUG, use the oldest maintained branch that contains the bug (see https://symfony.com/roadmap for the list of maintained branches). If your pull request documents a NEW FEATURE, use the same Symfony branch where the feature was introduced (and `master` for features of unreleased versions). --> Commits ------- 0f65736 Add buffer configuration option to http_client
@rjwebdev thanks for this ... and congrats on your first Symfony Docs contribution! @OskarStark I did some rewords while merging. Thanks. |
…th a Closure (rjwebdev) This PR was merged into the 4.4 branch. Discussion ---------- [HttpClient] Allow enabling buffering conditionally with a Closure | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #31883 | License | MIT | Doc PR | symfony/symfony-docs#12043 With this PR, responses can be buffered automatically from a closure passed to the `buffer` option. ```php $resp = $client->request('GET', $url, [ 'buffer' => function (array $headers): bool { return true/false; }, ]); ``` When no option is provided, buffering is now enabled only for json, xml and text/* content types. Commits ------- f705ac9dc4 [HttpClient] Allow enabling buffering conditionally with a Closure
In PR symfony/symfony#32565, a regex value was added as a check to automatically buffer the content of a call. Since this is a new feature, the documentation of the http_client configuration true frameworkbundle is updated