mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Don't duplicate Rack::Response functionality. [#5320 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
This commit is contained in:
parent
c509379923
commit
308517e913
1 changed files with 4 additions and 18 deletions
|
@ -15,29 +15,15 @@ module ActionDispatch
|
|||
end
|
||||
|
||||
# Was the response successful?
|
||||
def success?
|
||||
(200..299).include?(response_code)
|
||||
end
|
||||
alias_method :success?, :successful?
|
||||
|
||||
# Was the URL not found?
|
||||
def missing?
|
||||
response_code == 404
|
||||
end
|
||||
alias_method :missing?, :not_found?
|
||||
|
||||
# Were we redirected?
|
||||
def redirect?
|
||||
(300..399).include?(response_code)
|
||||
end
|
||||
alias_method :redirect?, :redirection?
|
||||
|
||||
# Was there a server-side error?
|
||||
def error?
|
||||
(500..599).include?(response_code)
|
||||
end
|
||||
alias_method :server_error?, :error?
|
||||
|
||||
# Was there a client client?
|
||||
def client_error?
|
||||
(400..499).include?(response_code)
|
||||
end
|
||||
alias_method :error?, :server_error?
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue