foca icon indicating copy to clipboard operation
foca copied to clipboard

Check for content types accepted by client

Open uniqueg opened this issue 4 years ago • 16 comments

API endpoints can serve different content types, e.g., application/json, text/plain etc. Clients can ask a service to respond with one or more specific accepted content types.

It would be nice if FOCA implemented a solution (e.g., a decorator) that compares the client's desired content type(s) against the ones that the service offers for the respective endpoint (as defined in the API specs). An appropriate error response should be returned if a client requests a content type that the endpoint cannot deliver. If the client does not explicitly ask for a specific content type (i.e., if the Accept: <content-type> header is missing), the default response should be given.

Other important points to think about:

uniqueg avatar Sep 17 '20 17:09 uniqueg