middlewares / error-response

Middleware to create responses with error status code (4xx-5xx)
MIT License
6 stars 0 forks source link

ContentType Negotiation Required #1

Open mav2287 opened 4 years ago

mav2287 commented 4 years ago

Went to use this without knowing there had to be a Content-type negotiation. Had to go into the source to figure that out. Might be something use to add into the docs since it won't work out of the box without it.

oscarotero commented 4 years ago

Yes, you're right, the default behavior needs content-type header in the response. You can use the Negotiation middleware for that.

But you can create your own error response without check it, just have to implement the ResponderInterface and returning true for the isValid() method. And maybe there could be a generic responder to be used as fallback if not valid content type has found.