Skip to content

[4.x] Error handler does not add content-type header if default renderer is used #2749

Description

@adriansuter

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions