Skip to content

Is it possible to return Error Response which Content-Type is text/html? #2860

Answered by raphael
kitagry asked this question in Q&A
Discussion options

You must be logged in to vote

Hello, the text/html encoder only supports strings or slice of bytes, it doesn't know how to serialize an arbitrary object into HTML (there really isn't a well defined way to do that in general). You can either change the error type to be a string or provide your own encoder that knows how to serialize the error object into HTML.

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@kitagry
Comment options

@raphael
Comment options

@kitagry
Comment options

@raphael
Comment options

@kitagry
Comment options

Answer selected by kitagry
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants