Skip to content

[HttpClient] add StreamableInterface to ease turning responses into PHP streams #37443

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
Jun 30, 2020

Conversation

nicolas-grekas
Copy link
Member

Q A
Branch? master
Bug fix? no
New feature? yes
Deprecations? -
Tickets -
License MIT
Doc PR -

Copy link
Member

@Nyholm Nyholm left a comment

Choose a reason for hiding this comment

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

Thank you

@nicolas-grekas nicolas-grekas merged commit d555112 into symfony:master Jun 30, 2020
@nicolas-grekas nicolas-grekas deleted the hc-streamable branch July 2, 2020 12:04
@@ -95,7 +95,7 @@ public function toStream(bool $throw = true)
}

$handle = function () {
$stream = StreamWrapper::createResource($this->response);
$stream = $this->response instanceof StreamableInterface ? $this->response->toStream(false) : StreamWrapper::createResource($this->response);
Copy link
Member

Choose a reason for hiding this comment

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

wouldn't this bypass changes done by the passthru callable ?

Copy link
Member Author

Choose a reason for hiding this comment

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

nope: this only extracts any potential handle for stream_select(), but the stream is always read through the resource created L103 below, which goes through the AsyncResponse

@nicolas-grekas nicolas-grekas modified the milestones: next, 5.2 Oct 5, 2020
@fabpot fabpot mentioned this pull request Oct 5, 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.

5 participants