From 9ad64b0bd80b9ed91e52e03c1e6c2db2fbdb9b5e Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Mon, 21 Mar 2022 19:48:47 +0200 Subject: [PATCH] vweb: support `-d trace_request` and `-d trace_response` --- vlib/vweb/vweb.v | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/vlib/vweb/vweb.v b/vlib/vweb/vweb.v index 49a984bb3c..03551e9dcb 100644 --- a/vlib/vweb/vweb.v +++ b/vlib/vweb/vweb.v @@ -459,7 +459,12 @@ fn handle_conn(mut conn net.TcpConn, mut app T, routes map[string]Route) { } return } - + $if trace_request ? { + dump(req) + } + $if trace_request_url ? { + dump(req.url) + } // URL Parse url := urllib.parse(req.url) or { eprintln('error parsing path: $err') @@ -702,6 +707,9 @@ pub fn not_found() Result { } fn send_string(mut conn net.TcpConn, s string) ? { + $if trace_response ? { + eprintln('> send_string:\n$s\n') + } conn.write(s.bytes()) ? }