mirror of
https://gitea.invidious.io/iv-org/shard-kemal.git
synced 2024-08-15 00:53:36 +00:00
Move redirect macro to context def
This commit is contained in:
parent
4dd027eb96
commit
17f944ef9d
4 changed files with 56 additions and 56 deletions
|
@ -7,5 +7,10 @@ class HTTP::Server
|
|||
def params
|
||||
Kemal::ParamParser.new(@route, @request).parse
|
||||
end
|
||||
|
||||
def redirect(url)
|
||||
@response.headers.add "Location", url
|
||||
@response.status_code = 301
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -16,11 +16,6 @@ macro render(filename, layout)
|
|||
render {{layout}}
|
||||
end
|
||||
|
||||
macro redirect(url)
|
||||
env.response.headers.add "Location", {{url}}
|
||||
env.response.status_code = 301
|
||||
end
|
||||
|
||||
macro add_handler(handler)
|
||||
Kemal.config.add_handler {{handler}}
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue