Loosen Accept header check to allow starts with :api_json#869
Conversation
|
@lgebhardt just checking in, what do you think about loosening up the check for a valid Accept header so that the check matches that the header string begins with the "all media types" or :json_api mime type? |
|
@pixelhandler The first change for allowing
But maybe I'm reading it wrong. I'd like to get @dgeb's opinion. |
|
I should add I have no issue with allowing a configuration option to allow this, but I want to make sure the defaults adhere to the spec. |
|
@lgebhardt this is my motivation https://github.com/EDMC/api-versions#versions-are-specified-by-header-not-by-url Here is a tongue and cheek article on the subject: https://www.troyhunt.com/your-api-versioning-is-wrong-which-is/ Also, https://blog.pivotal.io/pivotal-labs/labs/api-versioning And I generally agree with http://blog.steveklabnik.com/posts/2011-07-03-nobody-understands-rest-or-http#i_want_my_api_to_be_versioned I commented here as well, json-api/json-api#406 (comment) |
|
@lgebhardt I can change this PR to remove the support for |
@pixelhandler Please do so, but open an additional issue instead of PR to discuss. There's a lot to unpack here, not least of which would be my preference to get JSONAPI out of the vendor tree and into the standards tree. But regardless, we can have a discussion about media type params in a separate issue if you like. I would like to get the change to |
|
@pixelhandler I see you just commented here: json-api/json-api#406 (comment) That's probably the best place for the discussion, since JR will simply follow the spec. Thanks for bringing this up! |
12606ad to
ee8cf2c
Compare
|
@lgebhardt @dgeb I revised the PR and squashed the commit, thanks for the feedback. I also created https://github.com/cerebris/jsonapi-resources/issues/874 to track any possibility of configuring for using a version media type parameter. |
|
@pixelhandler Thanks! |
|
@lgebhardt you're welcome. It's a pleasure to use this gem ! |
@pixelhandler I tend to agree with @steveklabnik's comment in the intro:
I'm approaching the versioning from the standpoint that a server will support multiple versions simultaneously. In JR this is easily done with the URI and name-spaced resources. It would not be an easy retrofit to allow version switching based on the media type. However I can see using the media type version as a version check. Are you designing your server to speak multiple versions, or using the version to indicate the current version that the server is speaking? Hope that question makes sense. |
*/*(All media types)"*/*;q=0.8"Fixes #799