From 2281163efdabd418e234d9318a2eecd0e335d60a Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Fri, 3 Jul 2020 17:50:45 +0200 Subject: [PATCH] vweb: fix a routing bug --- vlib/v/parser/comptime.v | 1 - vlib/vweb/vweb.v | 18 ++++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/vlib/v/parser/comptime.v b/vlib/v/parser/comptime.v index c9a46c2d3d..ee4458d74f 100644 --- a/vlib/v/parser/comptime.v +++ b/vlib/v/parser/comptime.v @@ -147,7 +147,6 @@ fn (mut p Parser) vweb() ast.ComptimeCall { } fn (mut p Parser) comp_for() ast.CompFor { - println('COMP FOR') p.next() p.check(.key_for) val_var := p.check_name() diff --git a/vlib/vweb/vweb.v b/vlib/vweb/vweb.v index 8050243f35..97d19cab8d 100644 --- a/vlib/vweb/vweb.v +++ b/vlib/vweb/vweb.v @@ -337,16 +337,18 @@ fn handle_conn(conn net.Socket, mut app T) { break } } - } - if ok { - action = method - app.$method(vars) - conn.close() or {} - return + if ok { + action = method + println('OK !! $action="$action"') + app.$method(vars) + conn.close() or {} + return + } } } // No route matched, just do a simple `/home` => `action=home` if action == '' { + //println('action is empty because no routes were matched...') action = vals[1][1..].all_before('/') if action.contains('?') { action = action.all_before('?') @@ -355,9 +357,9 @@ fn handle_conn(conn net.Socket, mut app T) { action = 'index' } } - $if debug { + //$if debug { println('action=$action') - } + //} app.$action() /*