3 ms·
Tangential, but the lack of a "these types are available" as the counterpart to "Accept" has always been so obviously missing. What's the point of Accept if you
by afandian 3y ago
Tangential, but the lack of a "these types are available" as the counterpart to "Accept" has always been so obviously missing. What's the point of Accept if you don't know what to ask for?
Maybe in the trivial case saying "I'd prefer a JPG to a PNG" can be an assymetrical choice. But in all the interesting use cases I can think of, e.g. where there are competing representation formats, you'd want the server to be able to respond to a HEAD with the choices.
That's the kind of thing you can put in Swagger, but that might lead to hoisting the client's choice into the API, away from Content Negotiation.
- duskwuff 3y agoThe OPTIONS response already describes which methods are available for an endpoint in the Allow header. Including a list of available types in a new header would be a pretty natural extension. (Content-Type isn't available because it's defined to only contain a single media type.)
- stephenr 3y agoWhy? The whole point of content negotiation is the client tells the server which types it wants the content in, with weights to determine preference; The server then works out the best match for what's requested. Why do you need to ask about what's available? Just ask for it if you support it, and then handle the response based on its type.
- runeks 3y ago> What's the point of Accept if you don't know what to ask for? As a client, you do know what to ask for: everything you support, listed in order of preference. Why would you, as a client, care whether the server supports some format that you don't understand?
- deleted 3y ago[deleted]