mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
vweb: fix a routing bug
This commit is contained in:
parent
51410fdb6d
commit
2281163efd
@ -147,7 +147,6 @@ fn (mut p Parser) vweb() ast.ComptimeCall {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn (mut p Parser) comp_for() ast.CompFor {
|
fn (mut p Parser) comp_for() ast.CompFor {
|
||||||
println('COMP FOR')
|
|
||||||
p.next()
|
p.next()
|
||||||
p.check(.key_for)
|
p.check(.key_for)
|
||||||
val_var := p.check_name()
|
val_var := p.check_name()
|
||||||
|
@ -337,16 +337,18 @@ fn handle_conn<T>(conn net.Socket, mut app T) {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
if ok {
|
||||||
if ok {
|
action = method
|
||||||
action = method
|
println('OK !! $action="$action"')
|
||||||
app.$method(vars)
|
app.$method(vars)
|
||||||
conn.close() or {}
|
conn.close() or {}
|
||||||
return
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// No route matched, just do a simple `/home` => `action=home`
|
// No route matched, just do a simple `/home` => `action=home`
|
||||||
if action == '' {
|
if action == '' {
|
||||||
|
//println('action is empty because no routes were matched...')
|
||||||
action = vals[1][1..].all_before('/')
|
action = vals[1][1..].all_before('/')
|
||||||
if action.contains('?') {
|
if action.contains('?') {
|
||||||
action = action.all_before('?')
|
action = action.all_before('?')
|
||||||
@ -355,9 +357,9 @@ fn handle_conn<T>(conn net.Socket, mut app T) {
|
|||||||
action = 'index'
|
action = 'index'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$if debug {
|
//$if debug {
|
||||||
println('action=$action')
|
println('action=$action')
|
||||||
}
|
//}
|
||||||
|
|
||||||
app.$action()
|
app.$action()
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user