vweb: support `-d trace_request` and `-d trace_response`
parent
178afd006b
commit
9ad64b0bd8
|
@ -459,7 +459,12 @@ fn handle_conn<T>(mut conn net.TcpConn, mut app T, routes map[string]Route) {
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
$if trace_request ? {
|
||||||
|
dump(req)
|
||||||
|
}
|
||||||
|
$if trace_request_url ? {
|
||||||
|
dump(req.url)
|
||||||
|
}
|
||||||
// URL Parse
|
// URL Parse
|
||||||
url := urllib.parse(req.url) or {
|
url := urllib.parse(req.url) or {
|
||||||
eprintln('error parsing path: $err')
|
eprintln('error parsing path: $err')
|
||||||
|
@ -702,6 +707,9 @@ pub fn not_found() Result {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn send_string(mut conn net.TcpConn, s string) ? {
|
fn send_string(mut conn net.TcpConn, s string) ? {
|
||||||
|
$if trace_response ? {
|
||||||
|
eprintln('> send_string:\n$s\n')
|
||||||
|
}
|
||||||
conn.write(s.bytes()) ?
|
conn.write(s.bytes()) ?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue