Skip to content

Commit

Permalink
fix websocket issue with debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
dnesting committed Jun 2, 2023
1 parent 92e012c commit 8ee95c7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cmd/dummy/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func main() {
httpClient := http.DefaultClient
if *flagDebug {
// enable HTTP client logging
httpClient = sense.SetDebug(log.New(os.Stderr, "", log.LstdFlags|log.Lshortfile), httpClient)
httpClient = sense.SetDebug(log.New(os.Stdout, "", log.LstdFlags|log.Lshortfile|log.Lmicroseconds), httpClient)
}

clients, err := sensecli.CreateClients(ctx,
Expand Down
6 changes: 5 additions & 1 deletion internal/senseutil/senseutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ func DumpRequest(log *log.Logger, r *http.Request) {
}

func DumpResponse(log *log.Logger, r *http.Response) {
bytes, err := httputil.DumpResponse(r, true)
wantBody := true
if r.StatusCode < http.StatusOK {
wantBody = false
}
bytes, err := httputil.DumpResponse(r, wantBody)
if err != nil {
log.Println("error dumping response:", err)
} else {
Expand Down

0 comments on commit 8ee95c7

Please sign in to comment.