Skip to content
This repository has been archived by the owner on Jun 7, 2024. It is now read-only.

406 response does not list available contents types for negotiation #376

Open
rcillo opened this issue Aug 12, 2016 · 3 comments
Open

406 response does not list available contents types for negotiation #376

rcillo opened this issue Aug 12, 2016 · 3 comments

Comments

@rcillo
Copy link
Contributor

rcillo commented Aug 12, 2016

When a client posts an invalid event, Nakadi tries to reply with 422 status code and an JSON body.

But if client provides an invalid header, for example "Accept: application/json+problem", Nakadi replies with 406 and does not provide a list of available content types for negotiation.

I suggest that we accept any content type and always return a json regardless of the representation asked by users, since this is the only representation available.

@dehora
Copy link
Member

dehora commented Aug 12, 2016

I suggest that we accept any content type and always return a json regardless of the representation asked by users, since this is the only representation available.

If this is done (ie tie a generic media type to a custom type, or not require a media type), the API will probably have to take a position on what the default return is, if when multiple versioned media types exist. I've seen two forms:

  • Return the initial (earliest version). Upside: compatibility. Downside: ties the service to the oldest version indefinitely. Notably, performing a deprecation becomes complicated.
  • Return the current version: Upside: service evolution. Downside: incompatible results [1]. Typically the API needs to document that it has no compatibility guarantees on the general media type (or the absence of a media type).

Requiring a specific, non-floating media type avoids both of these at the cost of being inconvenient. The observation I'd make is that once you support generic or no media types, people will use them and may be surprised when things break, even if it's documented. It's a tricky thing to navigate :)


[1] There's a way around this, if you know something very specific about the caller, eg via a datable token or api key, which can force a transformation to a compatible format. That requires a good level of engineering to not become spaghetti, and the project doesn't have a clear way to support that kind of identification, so I'd rule this one out.

@lasomethingsomething
Copy link

Hi @rcillo @dehora, what's the next step for this issue? "Help Wanted," close, or other?

@lmontrieux
Copy link
Contributor

@rcillo @dehora This has been opened almost a year ago, and I don't think we've made any progress on this. Does one of you want to revive the discussion, or should we just close this?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants