Issue Bug Closed

#86370Missing content-type header in JsonView

Philipp Serrer 09/25/18, 14:17 updated 11/04/18, 19:12

Description

Currently the render function of TYPO3\CMS\Extbase\Mvc\View\JsonView tries to use tsfe to send the Content-type Header, but as this is later never evaluated, the Header gets completely lost.

This bug is visible, if you try to create a new form inside the new form extension. If you create a form, you just get the notification

> The form could not be saved: undefined

because the Response is treated as plain text instead of a json object.

To solve this, a simple solution would be to replace the following line inside the render function

$typoScriptFrontendController->setContentType('application/json')

with this

$response->setHeader('Content-Type', 'application/json');

but I’m not sure if this is the best way. Maybe the tsfe call is important and one should fix the wrapping if condition.

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.