Skip to content
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

[HttpClient] make response stream functionality consistent #35573

Merged
merged 1 commit into from
Feb 3, 2020
Merged

[HttpClient] make response stream functionality consistent #35573

merged 1 commit into from
Feb 3, 2020

Conversation

kbond
Copy link
Member

@kbond kbond commented Feb 3, 2020

Q A
Branch? master
Bug fix? no
New feature? no
Deprecations? no
Tickets n/a
License MIT
Doc PR n/a

There are three ways of creating a stream from a response:

  1. Calling $response->toStream() (if the response supports this)
  2. Calling StreamWrapper::createResource($response)
  3. Calling StreamWrapper::createResource($response, $httpClient) (note the second argument)

Currently, the 3rd method creates a stream that is not rewindable (the other two are). The first commit adds tests showing the inconsistencies (1 test fails). The second commit is a fix to make the 3 ways consistent.

See https://twitter.com/nicolasgrekas/status/1224047079422599168 for reference.

@nicolas-grekas nicolas-grekas added this to the next milestone Feb 3, 2020
@nicolas-grekas
Copy link
Member

Thank you @kbond.

nicolas-grekas added a commit that referenced this pull request Feb 3, 2020
… (kbond)

This PR was squashed before being merged into the 5.1-dev branch.

Discussion
----------

[HttpClient] make response stream functionality consistent

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Tickets       | n/a
| License       | MIT
| Doc PR        | n/a

There are three ways of creating a stream from a response:

1. Calling `$response->toStream()` (if the response supports this)
2. Calling `StreamWrapper::createResource($response)`
3. Calling `StreamWrapper::createResource($response, $httpClient)` (note the second argument)

Currently, the 3rd method creates a stream that is not rewindable (the other two are). The first commit adds tests showing the inconsistencies (1 test fails). The second commit is a fix to make the 3 ways consistent.

See https://twitter.com/nicolasgrekas/status/1224047079422599168 for reference.

Commits
-------

64f9111 [HttpClient] make response stream functionality consistent
@nicolas-grekas nicolas-grekas merged commit 64f9111 into symfony:master Feb 3, 2020
@kbond kbond deleted the http-stream branch February 3, 2020 15:35
@nicolas-grekas nicolas-grekas modified the milestones: next, 5.1 May 4, 2020
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.

None yet

3 participants