mirror of
https://gitea.invidious.io/iv-org/shard-kemal.git
synced 2024-08-15 00:53:36 +00:00
Adding method for doing browser redirection from inside any route.
Made some small changes
This commit is contained in:
parent
d25a611fbd
commit
cd69a866d5
3 changed files with 27 additions and 0 deletions
|
@ -184,4 +184,15 @@ describe "Kemal::Handler" do
|
|||
response.status_code.should eq(404)
|
||||
end
|
||||
|
||||
it "redirects user to provided url" do
|
||||
kemal = Kemal::Handler.new
|
||||
kemal.add_route "GET", "/" do |env|
|
||||
env.redirect("/login")
|
||||
end
|
||||
request = HTTP::Request.new("GET", "/")
|
||||
response = kemal.call(request)
|
||||
response.status_code.should eq(301)
|
||||
response.headers.has_key?("Location").should eq(true)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue