mirror of
https://gitea.invidious.io/iv-org/shard-kemal.git
synced 2024-08-15 00:53:36 +00:00
Merge pull request #32 from ilatif/master
Removed env from redirect and changed redirect from method to macro.
This commit is contained in:
commit
12c6af7d79
4 changed files with 7 additions and 7 deletions
|
@ -22,11 +22,6 @@ class Kemal::Context
|
|||
@response.content_type
|
||||
end
|
||||
|
||||
def redirect(url)
|
||||
@response.headers.add "Location", url
|
||||
@response.status_code = 301
|
||||
end
|
||||
|
||||
delegate headers, @request
|
||||
delegate status_code, @response
|
||||
delegate :"status_code=", @response
|
||||
|
|
4
src/kemal/macros.cr
Normal file
4
src/kemal/macros.cr
Normal file
|
@ -0,0 +1,4 @@
|
|||
macro redirect(url)
|
||||
env.response.headers.add "Location", {{url}}
|
||||
env.response.status_code = 301
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue