Skip to content

Commit 158fb5b

Browse files
committed
feat(cmd/httpdebug): add HTTP method and URI to output
Signed-off-by: Xe Iaso <[email protected]>
1 parent fd8c247 commit 158fb5b

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

cmd/httpdebug/main.go

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,18 @@ func main() {
3535
fmt.Fprint(w, "<pre id=\"main\"><code>")
3636
}
3737

38-
if !*silent {
39-
fmt.Println("---")
40-
r.Header.Write(io.MultiWriter(w, os.Stdout))
41-
} else {
42-
r.Header.Write(w)
38+
var out io.Writer
39+
40+
switch *silent {
41+
case true:
42+
out = w
43+
case false:
44+
out = io.MultiWriter(w, os.Stdout)
4345
}
4446

47+
fmt.Fprintln(out, r.Method, r.RequestURI)
48+
r.Header.Write(out)
49+
4550
if contains {
4651
fmt.Fprintln(w, "</pre></code>")
4752
}

0 commit comments

Comments
 (0)