vweb: fix a routing bug

pull/5644/head
Alexander Medvednikov 2020-07-03 17:50:45 +02:00
parent 51410fdb6d
commit 2281163efd
2 changed files with 10 additions and 9 deletions

View File

@ -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()

View File

@ -337,16 +337,18 @@ fn handle_conn<T>(conn net.Socket, mut app T) {
break
}
}
}
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<T>(conn net.Socket, mut app T) {
action = 'index'
}
}
$if debug {
//$if debug {
println('action=$action')
}
//}
app.$action()
/*