mirror of
https://gitea.invidious.io/iv-org/shard-kemal.git
synced 2024-08-15 00:53:36 +00:00
Allow HTTP::Server::Context#redirect to take an URL (#659)
This commit is contained in:
parent
a939a577de
commit
cb9adcd188
1 changed files with 2 additions and 2 deletions
|
@ -17,8 +17,8 @@ class HTTP::Server
|
|||
@params ||= Kemal::ParamParser.new(@request, route_lookup.params)
|
||||
end
|
||||
|
||||
def redirect(url : String, status_code : Int32 = 302, *, body : String? = nil, close : Bool = true)
|
||||
@response.headers.add "Location", url
|
||||
def redirect(url : String | URI, status_code : Int32 = 302, *, body : String? = nil, close : Bool = true)
|
||||
@response.headers.add "Location", url.to_s
|
||||
@response.status_code = status_code
|
||||
@response.print(body) if body
|
||||
@response.close if close
|
||||
|
|
Loading…
Reference in a new issue