From a273c3b18a217ece9455c0c360369eb726830fa2 Mon Sep 17 00:00:00 2001 From: jackspirou Date: Mon, 4 Jan 2016 13:51:48 -0600 Subject: [PATCH] attempting to make debug print moar pretty --- main.go | 9 +++++++-- types.go | 2 ++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index 94fdf44..2be2323 100644 --- a/main.go +++ b/main.go @@ -14,6 +14,11 @@ import ( "github.com/drone/drone-go/template" ) +const ( + respFormat = "Webhook %d\n URL: %s\n RESPONSE STATUS: %s\n RESPONSE BODY: %s\n" + debugRespFormat = "Webhook %d\n URL: %s\n METHOD: %s\n HEADERS: %s\n REQUEST BODY: %s\n RESPONSE STATUS: %s\n RESPONSE BODY: %s\n" +) + var ( build string buildDate string @@ -122,7 +127,7 @@ func main() { if vargs.Debug { fmt.Printf( - "Webhook %d\n URL: %s\n METHOD: %s\n HEADERS: %s\n REQUEST BODY: %s\n RESPONSE STATUS: %s\n RESPONSE BODY: %s\n", + debugRespFormat, i+1, req.URL, req.Method, @@ -133,7 +138,7 @@ func main() { ) } else { fmt.Printf( - "Webhook %d\n URL: %s\n RESPONSE STATUS: %s\n RESPONSE BODY: %s\n", + respFormat, i+1, req.URL, resp.Status, diff --git a/types.go b/types.go index 0dc03b2..59805f2 100644 --- a/types.go +++ b/types.go @@ -1,5 +1,6 @@ package main +// Params represents the valid paramenter options for the webhook plugin. type Params struct { Urls []string `json:"urls"` Debug bool `json:"debug"` @@ -10,6 +11,7 @@ type Params struct { ContentType string `json:"content_type"` } +// Auth represents a basic HTTP authentication username and password. type Auth struct { Username string `json:"username"` Password string `json:"password"`