Task #63643
closed
do you mean PSR7 responses here?
at the time of writing, there was no psr7 yet.
But yes, a response object might be based on
psr7 nowadays.
Point is to not directly send headers in the view object,
but add the headers to any type of response object instead.
- Sprint Focus set to On Location Sprint
- Sprint Focus deleted (
On Location Sprint)
Not doing this now since PSR-7 request/response is vastly different from Extbase request/response.
Making JsonView use Request/Response is not that easily possible without changing the ViewInterface in general since method render() must return a string. Still, this bug report is totally valid and must be addressed. My idea is as follows:
Make every action return a ResponseInterface and make the user do something like this:
$response = new Response($this->view->render());
$response->setHeader('Content-Type', 'application/json');
Unfortunately we need people to set headers manually outside the JsonView or we let them use the core JsonResponse which does the job for them. But setting headers in the view is a no go indeed.
- Related to Epic #92512: PSR-7 Request/Response handling in Extbase added
- Status changed from New to Closed
If I understand the issue correctly, we addressed this in v11 in a slightly different way: jsonview renders the json_encode'd string, ActionController->jsonResponse() can be used to create a response with appropriate headers from it.
I'll close the issue for now since I think it's resolved. Re-open or create a new one if anyone disagrees.
Also available in: Atom
PDF