Merge pull request #32 from ilatif/master

Removed env from redirect and changed redirect from method to macro.
This commit is contained in:
Serdar Dogruyol 2015-12-09 22:27:04 +02:00
commit 12c6af7d79
4 changed files with 7 additions and 7 deletions

View file

@ -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
View file

@ -0,0 +1,4 @@
macro redirect(url)
env.response.headers.add "Location", {{url}}
env.response.status_code = 301
end