haskell-servant / servant

Servat is a Haskell DSL for describing, serving, querying, mocking, documenting web applications and more!
https://docs.servant.dev/
1.82k stars 412 forks source link

Return `Accept` header when `Bad Content Type` is reported... #1655

Open mgajda opened 1 year ago

mgajda commented 1 year ago

According to HTTP standard, when "Bad content type" is reported, we should send a list of accepted content types for the given address in Accept header. This could be realized by a walk over the type with a given path.

This allows for content negotiation and speeds up debugging expectations of API servers: https://developer.mozilla.org/en-US/docs/Web/HTTP/Content_negotiation#the_accept_header

mgajda commented 1 year ago

May be related to example in #1246.