making the debug print pretty
This commit is contained in:
parent
099c8ee9aa
commit
d9380902f2
13
main.go
13
main.go
|
@ -112,7 +112,7 @@ func main() {
|
||||||
}
|
}
|
||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
|
|
||||||
if vargs.Verbose || os.Getenv("DEBUG") == "true" {
|
if vargs.Debug || os.Getenv("DEBUG") == "true" {
|
||||||
|
|
||||||
body, err := ioutil.ReadAll(resp.Body)
|
body, err := ioutil.ReadAll(resp.Body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -121,15 +121,8 @@ func main() {
|
||||||
fmt.Printf("Error reading http response body. %s\n", err)
|
fmt.Printf("Error reading http response body. %s\n", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// scrub out basic auth pass
|
// debug print
|
||||||
/*
|
fmt.Printf("[debug] Webhook %d\n URL: %s\n METHOD: %s\n HEADERS: %s\n REQUEST BODY: %s\n RESPONSE STATUS: %s\n RESPONSE BODY: %s\n", i+1, req.URL, req.Method, req.Header, string(b), resp.Status, string(body))
|
||||||
if len(vargs.Auth.Password) > 0 {
|
|
||||||
req.SetBasicAuth(vargs.Auth.Username, "XXXXX")
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
// print out
|
|
||||||
fmt.Printf("Webhook URL %d\n URL: %s\n METHOD: %s\n HEADERS: %s\n BODY: %s\n RESPONSE STATUS: %s\n RESPONSE: %s\n", i+1, req.URL, req.Method, req.Header, string(b), resp.Status, string(body))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ package main
|
||||||
|
|
||||||
type Webhook struct {
|
type Webhook struct {
|
||||||
Urls []string `json:"urls"`
|
Urls []string `json:"urls"`
|
||||||
Verbose bool `json:"verbose"`
|
Debug bool `json:"debug"`
|
||||||
Auth BasicAuth `json:"auth"`
|
Auth BasicAuth `json:"auth"`
|
||||||
Headers map[string]string `json:"header"`
|
Headers map[string]string `json:"header"`
|
||||||
Method string `json:"method"`
|
Method string `json:"method"`
|
||||||
|
|
Loading…
Reference in New Issue
Block a user