Skip to content

Commit

Permalink
feat(client): Trace request headers as well as response headers
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanilves committed Feb 6, 2020
1 parent 666a8fb commit fda7542
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion api/v1/registry/client/request/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,11 @@ func perform(url, auth, mode string, trace bool) (resp *http.Response, err error

if trace {
fmt.Printf("%s|@URL: %s\n", rid, url)
for k, v := range req.Header {
fmt.Printf("%s|@REQ-HEADER: %-40s = %s\n", rid, k, v)
}
for k, v := range resp.Header {
fmt.Printf("%s|@HEADER: %-40s = %s\n", rid, k, v)
fmt.Printf("%s|@RESP-HEADER: %-40s = %s\n", rid, k, v)
}
fmt.Printf("%s|--- BODY BEGIN ---\n", rid)
for _, line := range strings.Split(getResponseBody(resp), "\n") {
Expand Down

0 comments on commit fda7542

Please sign in to comment.