Depending on the error renderer, the error handler should correctly add a content-type header to the response.
HtmlErrorRenderer
text/html
JsonErrorRenderer
application/json
PlainTextErrorRenderer
text/plain
XmlErrorRenderer
text/xml
Proposition A
Add a new method to the renderer interface that would return the content-type.
Proposition B
Add a method to the renderer interface that receives the response and returns a possibly altered response (for example headers added). Method name to be discussed 😃.
Caution
Both propositions would introduce a breaking change.
Other ideas or inputs? Could we just use the $contentType property from the error handler itself? Or could that be dangerous as this is actually user input? What to do in case of the default error renderer?
Depending on the error renderer, the error handler should correctly add a content-type header to the response.
HtmlErrorRenderer
text/html
JsonErrorRenderer
application/json
PlainTextErrorRenderer
text/plain
XmlErrorRenderer
text/xml
Proposition A
Add a new method to the renderer interface that would return the content-type.
Proposition B
Add a method to the renderer interface that receives the response and returns a possibly altered response (for example headers added). Method name to be discussed 😃.
Caution
Both propositions would introduce a breaking change.
Other ideas or inputs? Could we just use the
$contentTypeproperty from the error handler itself? Or could that be dangerous as this is actually user input? What to do in case of the default error renderer?