Skip to content

[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

Merged
merged 1 commit into from
Sep 18, 2019

Conversation

rjwebdev
Copy link
Contributor

@rjwebdev rjwebdev commented Jul 27, 2019

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

In PR 32565, a regex value was added as a check to automatically buffer the content of a call
@OskarStark OskarStark added the Waiting Code Merge Docs for features pending to be merged label Jul 27, 2019
@OskarStark OskarStark added this to the 4.4 milestone Jul 27, 2019
nicolas-grekas added a commit to symfony/symfony that referenced this pull request Sep 9, 2019
…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
symfony-splitter pushed a commit to symfony/http-client that referenced this pull request Sep 9, 2019
…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
@OskarStark OskarStark removed the Waiting Code Merge Docs for features pending to be merged label Sep 9, 2019
Copy link
Contributor

@OskarStark OskarStark left a 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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
should be buffered

javiereguiluz added a commit to javiereguiluz/symfony-docs that referenced this pull request Sep 18, 2019
…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
@javiereguiluz javiereguiluz merged commit 0f65736 into symfony:4.4 Sep 18, 2019
@javiereguiluz
Copy link
Member

@rjwebdev thanks for this ... and congrats on your first Symfony Docs contribution!

@OskarStark I did some rewords while merging. Thanks.

javiereguiluz added a commit that referenced this pull request Sep 18, 2019
…iluz)

This PR was merged into the 4.3 branch.

Discussion
----------

[HttpClient] Add the buffer option to 4.3 too

After merging #12043 I realized we need to document it in 4.3 too.

Commits
-------

c82e6b8 [HttpClient] Add the buffer option to 4.3 too
sadafrangian3 pushed a commit to sadafrangian3/Dependency-Injection-http-client that referenced this pull request Nov 2, 2022
…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
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.

4 participants