Last active
February 24, 2022 13:29
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ( | |
"io" | |
"log" | |
"io" | |
"net/http" | |
) | |
func dumpResponse(r http.Response) { | |
io.Copy(os.Stdout, r.Body) | |
log.Println("") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How to dump
http.Response
body to log output using anio.Writer
, -for debugging purposes