-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
JsonResponse setContent, setEncodingOptions #16541
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
Any thoughts? |
I currently use the generic Also combining setContent and setCallback leads to unexpected behaviour.. as the callback should be part of the content. Currently nothing happens :( My2cents :) |
@ro0NL I don't like it either, but re-decoding is the quickest solution with existing code. |
Please look at #16551 |
How about a
|
Closing it as fixed by #19552 where we added |
Consider when creating a
JsonResponse
and callingsetContent()
instead ofsetData()
(bypassingthis->data
and meant for adding serialized content straight onto$this->content
and skipping the added json_encode feature.This will return an empty string as the JsonResponse content. Of course when setting content manually, there is no need for setting options anymore. However it's not always clear when data or content is passed to a JsonResponse. Inside the
setEncodingOptions()
:This also triggers the re-adding of
this->data
as content. I think this leads to enexpected behaviour. This proposal might not be the prettiest, but it works:Another option to get rid of this issue is when calling
setContent()
, try to set and isFinal flag or something.The text was updated successfully, but these errors were encountered: