Created
March 8, 2017 18:01
-
-
Save johnlonganecker/9ad7bbd1b29785805ded6addaff7c54f to your computer and use it in GitHub Desktop.
Dump HTTP Request for debugging
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 "net/http/httputil" | |
func (c *Client) DoRequest(r *request) (*http.Response, error) { | |
req, err := r.toHTTP() | |
if err != nil { | |
return nil, err | |
} | |
req.Header.Set("User-Agent", c.config.UserAgent) | |
if r.body != nil { | |
req.Header.Set("Content-type", "application/json") | |
} | |
asdf, _ := httputil.DumpRequest(req, true) | |
fmt.Println(string(asdf)) | |
resp, err := c.config.HttpClient.Do(req) | |
return resp, err | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment