Skip to content

Instantly share code, notes, and snippets.

@vidhill
Last active February 24, 2022 13:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vidhill/a04897310b7f3e481a1b5d3ab8e95b77 to your computer and use it in GitHub Desktop.
Save vidhill/a04897310b7f3e481a1b5d3ab8e95b77 to your computer and use it in GitHub Desktop.
Go, how to dump `http.Response` body to log output using an `io.Writer`, -for debugging purposes
import (
"io"
"log"
"io"
"net/http"
)
func dumpResponse(r http.Response) {
io.Copy(os.Stdout, r.Body)
log.Println("")
}
@vidhill
Copy link
Author

vidhill commented Aug 20, 2021

How to dump http.Response body to log output using an io.Writer, -for debugging purposes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment