Skip to content

Instantly share code, notes, and snippets.

@bobuva
Last active July 6, 2017 20:56
Show Gist options
  • Save bobuva/83e67a7d0db1b885e4403a32f4054c17 to your computer and use it in GitHub Desktop.
Save bobuva/83e67a7d0db1b885e4403a32f4054c17 to your computer and use it in GitHub Desktop.
Print out HTTP Request for debugging purposes
// Reference: https://golang.org/pkg/net/http/httputil/#DumpRequest
import (
"net/http/httputil"
)
// Print this request for debugging.
// request: the http.Request object.
requestDump, err := httputil.DumpRequest(request, true)
if err != nil {
fmt.Println(err)
}
fmt.Println(string(requestDump))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment