Replace unprocessable_entity -> unprocessable_content (#35658)

This commit is contained in:
Matt Jankowski authored and GitHub committed 2025-08-05 07:42:08 +00:00
1 parent 5318957ab3
commit 8131268256
5 files changed
+10 -10

No files matched your search

+1 -1
View File
@@ -20,7 +20,7 @@ class Api::V2::SearchController < Api::BaseController
@search = Search.new(search_results)
render json: @search, serializer: REST::SearchSerializer
rescue Mastodon::SyntaxError
unprocessable_entity
unprocessable_content
rescue ActiveRecord::RecordNotFound
not_found
end
+2 -2
View File
@@ -28,7 +28,7 @@ class ApplicationController < ActionController::Base
rescue_from Mastodon::NotPermittedError, with: :forbidden
rescue_from ActionController::RoutingError, ActiveRecord::RecordNotFound, with: :not_found
rescue_from ActionController::UnknownFormat, with: :not_acceptable
rescue_from ActionController::InvalidAuthenticityToken, with: :unprocessable_entity
rescue_from ActionController::InvalidAuthenticityToken, with: :unprocessable_content
rescue_from Mastodon::RateLimitExceededError, with: :too_many_requests
rescue_from(*Mastodon::HTTP_CONNECTION_ERRORS, with: :internal_server_error)
@@ -123,7 +123,7 @@ class ApplicationController < ActionController::Base
respond_with_error(410)
end
def unprocessable_entity
def unprocessable_content
respond_with_error(422)
end
@@ -52,7 +52,7 @@ module Settings
end
else
flash[:error] = I18n.t('webauthn_credentials.create.error')
status = :unprocessable_entity
status = :unprocessable_content
end
else
flash[:error] = t('webauthn_credentials.create.error')
@@ -219,16 +219,16 @@ RSpec.describe ApplicationController do
it_behaves_like 'error response', 410
end
describe 'unprocessable_entity' do
describe 'unprocessable_content' do
controller do
def route_unprocessable_entity
unprocessable_entity
def route_unprocessable_content
unprocessable_content
end
end
subject do
routes.draw { get 'route_unprocessable_entity' => 'anonymous#route_unprocessable_entity' }
get 'route_unprocessable_entity'
routes.draw { get 'route_unprocessable_content' => 'anonymous#route_unprocessable_content' }
get 'route_unprocessable_content'
end
it_behaves_like 'error response', 422
+1 -1
View File
@@ -98,7 +98,7 @@ RSpec.describe 'Search API' do
context 'when search raises syntax error' do
before { allow(Search).to receive(:new).and_raise(Mastodon::SyntaxError) }
it 'returns http unprocessable_entity' do
it 'returns http unprocessable_content' do
get '/api/v2/search', headers: headers, params: params
expect(response).to have_http_status(422)