Skip to content

Accept and Content-Type headers are not verified #99

Description

@krasnoukhov

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?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions