Skip to content

Instantly share code, notes, and snippets.

@vidhill
Created September 16, 2022 13:55
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/8b9280451bf49abf828a513217db9084 to your computer and use it in GitHub Desktop.
Save vidhill/8b9280451bf49abf828a513217db9084 to your computer and use it in GitHub Desktop.
Make copy of response body reader, and dump json
package main
import (
"io"
"net/http"
"os"
"strings"
)
func dummmy(){
response := &http.Response{
Body: io.NopCloser(strings.NewReader(`{"foo": "bar"}`)),
}
responseBodyCopy := io.TeeReader(response.Body, os.Stdout)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment