laminas-api-tools / api-tools-rest

Laminas Module providing structure for RESTful resources
https://api-tools.getlaminas.org/documentation
BSD 3-Clause "New" or "Revised" License
7 stars 16 forks source link

Content negotiation for errors (404, 405, ...) #7

Open weierophinney opened 4 years ago

weierophinney commented 4 years ago

Will be nice if the response of a global error thrown by the library respect the media type provided by Accept header.

This is when error is thrown to a browser (Accept: text/html) error is rendered like now but if it's thrown to the API client (Accept: application/*json) return application/problem+json response.


Originally posted by @Maks3w at https://github.com/zfcampus/zf-rest/issues/72

weierophinney commented 4 years ago

The final idea is all errors returned from any application layer (PHP, ZF2, zf-rest, user resource) should have the same response type.


Originally posted by @Maks3w at https://github.com/zfcampus/zf-rest/issues/72#issuecomment-93675286

weierophinney commented 4 years ago

+1 ... this seems to be a good idea .... is there any progress/comment, if this will be considered?


Originally posted by @jg-development at https://github.com/zfcampus/zf-rest/issues/72#issuecomment-134669864