File tree Expand file tree Collapse file tree 5 files changed +20
-6
lines changed Expand file tree Collapse file tree 5 files changed +20
-6
lines changed Original file line number Diff line number Diff line change @@ -249,9 +249,9 @@ def _allow_other_host
249
249
250
250
def _extract_redirect_to_status ( options , response_options )
251
251
if options . is_a? ( Hash ) && options . key? ( :status )
252
- Rack :: Utils . status_code ( options . delete ( :status ) )
252
+ ActionDispatch :: Response . rack_status_code ( options . delete ( :status ) )
253
253
elsif response_options . key? ( :status )
254
- Rack :: Utils . status_code ( response_options [ :status ] )
254
+ ActionDispatch :: Response . rack_status_code ( response_options [ :status ] )
255
255
else
256
256
302
257
257
end
Original file line number Diff line number Diff line change @@ -238,7 +238,7 @@ def _normalize_options(options)
238
238
end
239
239
240
240
if options [ :status ]
241
- options [ :status ] = Rack :: Utils . status_code ( options [ :status ] )
241
+ options [ :status ] = ActionDispatch :: Response . rack_status_code ( options [ :status ] )
242
242
end
243
243
244
244
super
Original file line number Diff line number Diff line change @@ -46,6 +46,20 @@ class Response
46
46
Headers = ::Rack ::Utils ::HeaderHash
47
47
end
48
48
49
+ class << self
50
+ if ActionDispatch ::Constants ::UNPROCESSABLE_CONTENT == :unprocessable_content
51
+ def rack_status_code ( status ) # :nodoc:
52
+ status = :unprocessable_content if status == :unprocessable_entity
53
+ Rack ::Utils . status_code ( status )
54
+ end
55
+ else
56
+ def rack_status_code ( status ) # :nodoc:
57
+ status = :unprocessable_entity if status == :unprocessable_content
58
+ Rack ::Utils . status_code ( status )
59
+ end
60
+ end
61
+ end
62
+
49
63
# To be deprecated:
50
64
Header = Headers
51
65
@@ -257,7 +271,7 @@ def sent?; synchronize { @sent }; end
257
271
258
272
# Sets the HTTP status code.
259
273
def status = ( status )
260
- @status = Rack :: Utils . status_code ( status )
274
+ @status = Response . rack_status_code ( status )
261
275
end
262
276
263
277
# Sets the HTTP response's content MIME type. For example, in the controller you
Original file line number Diff line number Diff line change @@ -178,7 +178,7 @@ def traces
178
178
end
179
179
180
180
def self . status_code_for_exception ( class_name )
181
- Rack :: Utils . status_code ( @@rescue_responses [ class_name ] )
181
+ ActionDispatch :: Response . rack_status_code ( @@rescue_responses [ class_name ] )
182
182
end
183
183
184
184
def show? ( request )
Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ def code_and_name
38
38
39
39
private
40
40
def code_from_name ( name )
41
- GENERIC_RESPONSE_CODES [ name ] || Rack :: Utils . status_code ( name )
41
+ GENERIC_RESPONSE_CODES [ name ] || ActionDispatch :: Response . rack_status_code ( name )
42
42
end
43
43
44
44
def name_from_code ( code )
You can’t perform that action at this time.
0 commit comments