nitlanguage
/
nit.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
fbb571d
)
lib/popcorn: App uses pre / post middlewares
author
Alexandre Terrasa
<alexandre@moz-code.org>
Mon, 23 May 2016 20:52:36 +0000
(16:52 -0400)
committer
Alexandre Terrasa
<alexandre@moz-code.org>
Wed, 25 May 2016 03:37:13 +0000
(23:37 -0400)
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
lib/popcorn/popcorn.nit
patch
|
blob
|
history
diff --git
a/lib/popcorn/popcorn.nit
b/lib/popcorn/popcorn.nit
index
887c122
..
64e4459
100644
(file)
--- a/
lib/popcorn/popcorn.nit
+++ b/
lib/popcorn/popcorn.nit
@@
-48,12
+48,19
@@
redef class App
redef fun answer(req, uri) do
uri = uri.simplify_path
var res = new HttpResponse(404)
+ for route, handler in pre_handlers do
+ handler.handle(route, uri, req, res)
+ end
for route, handler in handlers do
handler.handle(route, uri, req, res)
+ if res.sent then break
end
if not res.sent then
res.send(error_tpl(res.status_code, res.status_message), 404)
end
+ for route, handler in post_handlers do
+ handler.handle(route, uri, req, res)
+ end
res.session = req.session
return res
end