method
redirect_to
v7.2.3 -
Show latest stable
- Class:
ActionDispatch::ActionableExceptions
redirect_to(location)private
No documentation available.
# File actionpack/lib/action_dispatch/middleware/actionable_exceptions.rb, line 30
def redirect_to(location)
uri = URI.parse location
if uri.relative? || uri.scheme == "http" || uri.scheme == "https"
body = ""
else
return [400, { Rack::CONTENT_TYPE => "text/plain; charset=utf-8" }, ["Invalid redirection URI"]]
end
[302, {
Rack::CONTENT_TYPE => "text/html; charset=#{Response.default_charset}",
Rack::CONTENT_LENGTH => body.bytesize.to_s,
ActionDispatch::Constants::LOCATION => location,
}, [body]]
end