Skip to content

Commit d19ab43

Browse files
authored
Rails 7.0 deprecates content_type in favor of media_type (#1390)
Deprecates content_type in favor of media_type
1 parent bf4b4cd commit d19ab43

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

lib/jsonapi/acts_as_resource_controller.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,8 @@ def resource_klass_name
167167

168168
def verify_content_type_header
169169
if ['create', 'create_relationship', 'update_relationship', 'update'].include?(params[:action])
170-
unless request.content_type == JSONAPI::MEDIA_TYPE
171-
fail JSONAPI::Exceptions::UnsupportedMediaTypeError.new(request.content_type)
170+
unless request.media_type == JSONAPI::MEDIA_TYPE
171+
fail JSONAPI::Exceptions::UnsupportedMediaTypeError.new(request.media_type)
172172
end
173173
end
174174
end

test/helpers/functional_helpers.rb

Lines changed: 2 additions & 2 deletions
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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ class ActionDispatch::IntegrationTest
474474
fixtures :all
475475

476476
def assert_jsonapi_response(expected_status, msg = nil)
477-
assert_equal JSONAPI::MEDIA_TYPE, response.content_type
477+
assert_equal JSONAPI::MEDIA_TYPE, response.media_type
478478
if status != expected_status && status >= 400
479479
pp json_response rescue nil
480480
end

0 commit comments

Comments
 (0)