Skip to content

Conversation

@mtarld
Copy link
Contributor

@mtarld mtarld commented Apr 24, 2025

Q A
Branch? 7.3
Bug fix? yes
New feature? no
Deprecations? no
Issues
License MIT

The StreamedResponse doesn't flush after echoing. Therefore, all the chunks are kept in output buffer, which prevents proper streaming.

This PR triggers flushes after each echo.

@mtarld mtarld force-pushed the fix/flush-streamed-response branch from dfa336e to bf72397 Compare April 27, 2025 09:21
@fabpot
Copy link
Member

fabpot commented Apr 27, 2025

Thank you @mtarld.

@fabpot fabpot merged commit a2a47bc into symfony:7.3 Apr 27, 2025
9 of 11 checks passed
@xabbuh
Copy link
Member

xabbuh commented Apr 27, 2025

Should we update the class docblock now and remove the part about calling flush().

@chalasr
Copy link
Member

chalasr commented Apr 27, 2025

@xabbuh I don't think so. The added flush is only used by the callback that is created internally when the response is built with an iterable of content chunks, while that docblock suggests flushing from the user-defined callback you can pass instead of the chunks.

@mtarld mtarld deleted the fix/flush-streamed-response branch July 7, 2025 09:52
@mtarld mtarld restored the fix/flush-streamed-response branch July 7, 2025 09:52
nicolas-grekas added a commit that referenced this pull request Nov 12, 2025
…ttpKernelBrowser (wuchen90)

This PR was merged into the 7.3 branch.

Discussion
----------

[HttpKernel] Fix StreamedResponse with chunks support in HttpKernelBrowser

| Q             | A
| ------------- | ---
| Branch?       | 7.3
| Bug fix?      | yes
| New feature?  | no <!-- if yes, also update src/**/CHANGELOG.md -->
| Deprecations? | no <!-- if yes, also update UPGRADE-*.md and src/**/CHANGELOG.md -->
| License       | MIT

This PR fixes changes done in #60262 that breaks `HttpKernelBrowser` when it comes to deal with `StreamedResponse` created with an iterator.

Commits
-------

2932941 [HttpKernel] Fix StreamedResponse with chunks support in HttpKernelBrowser
symfony-splitter pushed a commit to symfony/http-kernel that referenced this pull request Nov 12, 2025
…ttpKernelBrowser (wuchen90)

This PR was merged into the 7.3 branch.

Discussion
----------

[HttpKernel] Fix StreamedResponse with chunks support in HttpKernelBrowser

| Q             | A
| ------------- | ---
| Branch?       | 7.3
| Bug fix?      | yes
| New feature?  | no <!-- if yes, also update src/**/CHANGELOG.md -->
| Deprecations? | no <!-- if yes, also update UPGRADE-*.md and src/**/CHANGELOG.md -->
| License       | MIT

This PR fixes changes done in symfony/symfony#60262 that breaks `HttpKernelBrowser` when it comes to deal with `StreamedResponse` created with an iterator.

Commits
-------

29329413350 [HttpKernel] Fix StreamedResponse with chunks support in HttpKernelBrowser
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