diff --git a/lib/jsonapi/acts_as_resource_controller.rb b/lib/jsonapi/acts_as_resource_controller.rb index 580b8e9a4..0d4ebb677 100644 --- a/lib/jsonapi/acts_as_resource_controller.rb +++ b/lib/jsonapi/acts_as_resource_controller.rb @@ -140,8 +140,8 @@ def resource_klass_name end def verify_content_type_header - unless request.content_type == JSONAPI::MEDIA_TYPE - fail JSONAPI::Exceptions::UnsupportedMediaTypeError.new(request.content_type) + unless request.media_type == JSONAPI::MEDIA_TYPE + fail JSONAPI::Exceptions::UnsupportedMediaTypeError.new(request.media_type) end true rescue => e diff --git a/test/helpers/functional_helpers.rb b/test/helpers/functional_helpers.rb index e0f504df2..3d6dc9d34 100644 --- a/test/helpers/functional_helpers.rb +++ b/test/helpers/functional_helpers.rb @@ -32,8 +32,8 @@ module FunctionalHelpers # end # end # - # if @response.content_type - # ct = @response.content_type + # if @response.media_type + # ct = @response.media_type # elsif methods.include?('assert_response_response') # ct = assert_response_response # else diff --git a/test/test_helper.rb b/test/test_helper.rb index ee2b36674..30d439ddb 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -471,7 +471,7 @@ class ActionDispatch::IntegrationTest fixtures :all def assert_jsonapi_response(expected_status, msg = nil) - media_type = Rails::VERSION::MAJOR >= 6 ? response.media_type : response.content_type + media_type = response.media_type assert_equal JSONAPI::MEDIA_TYPE, media_type if status != expected_status && status >= 400 pp json_response rescue nil