clojure-liberator / liberator

Liberator is a Clojure library for building RESTful applications.
http://clojure-liberator.github.io/liberator
Other
1.26k stars 130 forks source link

Content-negotation for error handlers #152

Open ordnungswidrig opened 10 years ago

ordnungswidrig commented 10 years ago

Error responses might provide need a different set of media-types for the response, e.g. a resource the provides an image of types image/jpg and image/png might want to return a 401 unauthorized with the media types text/plain, text/html or application/json instead.

In addition liberators handler see a negotiated media type after successful content negotiation. That means that for handlers like handle-unauthorized or handle-service-not-available cannot provide a matching response without additional work.

ordnungswidrig commented 10 years ago

If implemented this will fix #69, #122, #82

cbui commented 10 years ago

I'm having a hard time understanding what the proposed solution is, and I read the other threads. Could you reexplain?

ordnungswidrig commented 9 years ago

@Christopher-Bui I propose to add another declaration in the resource definition for the media types of error responses and to negotiate the content type when necessary. As a default available-media-types et. al. would be used.

ordnungswidrig commented 9 years ago

This will also likely fix #76