mirror of
https://github.com/drone-plugins/drone-webhook.git
synced 2026-06-14 05:12:43 +08:00
Add support for skip_verify in drone-webhook
This commit is contained in:
@@ -2,6 +2,7 @@ package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"crypto/tls"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
@@ -108,7 +109,15 @@ func main() {
|
||||
req.SetBasicAuth(vargs.Auth.Username, vargs.Auth.Password)
|
||||
}
|
||||
|
||||
resp, err := http.DefaultClient.Do(req)
|
||||
client := http.DefaultClient
|
||||
if vargs.SkipVerify {
|
||||
client = &http.Client{
|
||||
Transport: &http.Transport{
|
||||
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
|
||||
},
|
||||
}
|
||||
}
|
||||
resp, err := client.Do(req)
|
||||
|
||||
if err != nil {
|
||||
fmt.Printf("Error: Failed to execute the HTTP request. %s\n", err)
|
||||
|
||||
Reference in New Issue
Block a user