Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accept and Content-Type headers are not verified #99

Open
krasnoukhov opened this issue Mar 21, 2019 · 0 comments
Open

Accept and Content-Type headers are not verified #99

krasnoukhov opened this issue Mar 21, 2019 · 0 comments

Comments

@krasnoukhov
Copy link
Contributor

The issue was introduced in this commit: cerebris/jsonapi-resources@05f873c

Basically jsonapi-resources switched from the before_action to manually calling the header verification method(s). But jsonapi-utils does not do that at the moment, which violates the spec.

This can be verified easily by applying this diff:

diff --git a/spec/support/shared/jsonapi_request.rb b/spec/support/shared/jsonapi_request.rb
index 052ff89..0bc33c8 100644
--- a/spec/support/shared/jsonapi_request.rb
+++ b/spec/support/shared/jsonapi_request.rb
@@ -1,7 +1,7 @@
 shared_context 'JSON API headers' do
   let(:headers) do
-    { 'Accept'       => 'application/vnd.api+json',
-      'Content-Type' => 'application/vnd.api+json' }
+    { 'Accept'       => 'application/json',
+      'Content-Type' => 'application/json' }
   end
 
   before(:each) { request.headers.merge!(headers) }

And running the specs, which should not pass.

I wanted to provide a patch for this but honestly I'm not sure how to proceed. Any suggestions @tiagopog?

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

No branches or pull requests

1 participant