-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[HttpKernel] Why are StreamedResponse's sent by a kernel.response listener? #13591
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
Comments
|
Not sure I understand @ogizanagi, every kernel.response listener with a priority > -1024 (I assume most if not all) is executed before the StreamedResponseListener. |
Right. My assumptions were biased as I inverted the priority. Forget what I said :) The right answer is here : #2935 (comment) |
The response is send by the listener so that the callback is triggered before leaving the request scope, i.e. before leaving the |
I think it's safe to close the issue. @gerryvdm's question is answered in #2935 (comment) and it seems like there's nothing else to do. |
Could you please tell me why is this important at all? Why is that important to trigger callback in Kernel::handle() instead of in send() method in front controller? What's the difference at all? StreamedResponse works exactly the same without this listener and the listener breaks compatibility with tests. Here, in 2020 with Symfony 4.*, I tried to write tests for request which returns streamed response with PDF document. Wich StreamedResponseListener my terminal is polluted with binary contents. With StreamedResponseListener disabled response of the web application works exactly the same. The existence of StreamedResponseListener causes two negative things for tests:
So basically what's the difference? Can't we disable StreamedResponseListener, at least for tests? You can work around the problem using
|
I was wondering what the exact use of the StreamedResponseListener in the HttpKernel is, since responses are typically sent to the browser anyway by invoking Response::send() in the front controller.
Maybe this event subscriber can be eliminated? Or what are the use-cases?
The text was updated successfully, but these errors were encountered: