Merge pull request #7 from jackspirou/master
Trying to cleanup result and debug printing.
This commit is contained in:
commit
aa140a8128
9
main.go
9
main.go
|
@ -14,6 +14,11 @@ import (
|
||||||
"github.com/drone/drone-go/template"
|
"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 (
|
var (
|
||||||
build string
|
build string
|
||||||
buildDate string
|
buildDate string
|
||||||
|
@ -122,7 +127,7 @@ func main() {
|
||||||
|
|
||||||
if vargs.Debug {
|
if vargs.Debug {
|
||||||
fmt.Printf(
|
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,
|
i+1,
|
||||||
req.URL,
|
req.URL,
|
||||||
req.Method,
|
req.Method,
|
||||||
|
@ -133,7 +138,7 @@ func main() {
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
fmt.Printf(
|
fmt.Printf(
|
||||||
"Webhook %d\n URL: %s\n RESPONSE STATUS: %s\n RESPONSE BODY: %s\n",
|
respFormat,
|
||||||
i+1,
|
i+1,
|
||||||
req.URL,
|
req.URL,
|
||||||
resp.Status,
|
resp.Status,
|
||||||
|
|
2
types.go
2
types.go
|
@ -1,5 +1,6 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
|
// Params represents the valid paramenter options for the webhook plugin.
|
||||||
type Params struct {
|
type Params struct {
|
||||||
Urls []string `json:"urls"`
|
Urls []string `json:"urls"`
|
||||||
Debug bool `json:"debug"`
|
Debug bool `json:"debug"`
|
||||||
|
@ -10,6 +11,7 @@ type Params struct {
|
||||||
ContentType string `json:"content_type"`
|
ContentType string `json:"content_type"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Auth represents a basic HTTP authentication username and password.
|
||||||
type Auth struct {
|
type Auth struct {
|
||||||
Username string `json:"username"`
|
Username string `json:"username"`
|
||||||
Password string `json:"password"`
|
Password string `json:"password"`
|
||||||
|
|
Loading…
Reference in New Issue