Skip to content

Commit 190d1b3

Browse files
authored
Rails 7.0 deprecates content_type in favor of media_type (#1391)
Rails 7.0 deprecates content_type in favor of media_type
1 parent dc96280 commit 190d1b3

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

lib/jsonapi/acts_as_resource_controller.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,8 @@ def resource_klass_name
140140
end
141141

142142
def verify_content_type_header
143-
unless request.content_type == JSONAPI::MEDIA_TYPE
144-
fail JSONAPI::Exceptions::UnsupportedMediaTypeError.new(request.content_type)
143+
unless request.media_type == JSONAPI::MEDIA_TYPE
144+
fail JSONAPI::Exceptions::UnsupportedMediaTypeError.new(request.media_type)
145145
end
146146
true
147147
rescue => e

test/helpers/functional_helpers.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ module FunctionalHelpers
3232
# end
3333
# end
3434
#
35-
# if @response.content_type
36-
# ct = @response.content_type
35+
# if @response.media_type
36+
# ct = @response.media_type
3737
# elsif methods.include?('assert_response_response')
3838
# ct = assert_response_response
3939
# else

test/test_helper.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ class ActionDispatch::IntegrationTest
471471
fixtures :all
472472

473473
def assert_jsonapi_response(expected_status, msg = nil)
474-
media_type = Rails::VERSION::MAJOR >= 6 ? response.media_type : response.content_type
474+
media_type = response.media_type
475475
assert_equal JSONAPI::MEDIA_TYPE, media_type
476476
if status != expected_status && status >= 400
477477
pp json_response rescue nil

0 commit comments

Comments
 (0)