From b14f77985383bda25ebe5b253e8d963aa928335c Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Thu, 5 Nov 2020 22:58:31 +0200 Subject: [PATCH] vweb: add a placeholder for checking route validity at startup --- vlib/vweb/vweb.v | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/vlib/vweb/vweb.v b/vlib/vweb/vweb.v index b4822cb433..1e106213db 100644 --- a/vlib/vweb/vweb.v +++ b/vlib/vweb/vweb.v @@ -199,6 +199,11 @@ pub fn run_app(mut app T, port int) { l := net.listen(port) or { panic('failed to listen') } app.vweb = Context{} app.init_once() + $for method in T.methods { + $if method.return_type is Result { + // check routes for validity + } + } //app.reset() for { conn := l.accept() or { panic('accept() failed') } @@ -375,7 +380,7 @@ fn handle_conn(conn net.Socket, mut app T) { mut vars := []string{cap: route_words_a.len} mut action := '' $for method in T.methods { - $if method.return_type is Result { + $if method.return_type is Result { attrs := method.attrs route_words_a = [][]string{} if attrs.len == 0 {