tiagopog/jsonapi-utils

Accept and Content-Type headers are not verified

krasnoukhov opened this issue · 0 comments

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?