Need help with gencurl?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

sethgrid
154 Stars 17 Forks 23 Commits 3 Opened issues

Description

gencurl generates a curl command based on an http.Request to be used for logging and debugging

Services available

!
?

Need anything else?

Contributors list

# 348,476
Go
Shell
Java
5 commits
# 400,245
travis-...
gatsby
Algolia
sendgri...
4 commits

gencurl

gencurl generates a curl command based on an http.Request to be used for logging and debugging

// create an http request
data := []byte(`{"key":"value"}`)
req, err := http.NewRequest("POST", "http://www.example.com", bytes.NewBuffer(data))
if err != nil {
    // handle err
}
req.Header.Add("X-Custom", "custom data")

curl := gencurl.FromRequest(req)

// later, execute the request. On error, you can print curl to replicate and debug an issue

The generated curl command for this example would be:

curl -v -X POST --header 'X-Custom: custom data'   http://www.example.com -d '{"key":"value"}'

With this, you can test integrations and dig deeper. I suggest placing the generated curl in every error handling case dealing with an http request.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.