Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions pkg/dingtalk/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package dingtalk

import (
"bytes"
"crypto/tls"
"encoding/json"
"fmt"
"io/ioutil"
Expand All @@ -15,6 +16,7 @@ import (
type Client struct {
AccessToken string
Secret string
SkipVerify bool
}

// NewClient new dingtalk client
Expand Down Expand Up @@ -56,6 +58,11 @@ func (d *Client) Send(message Message) (string, *Response, error) {
req.Header.Add("Content-Type", "application/json")

client := new(http.Client)
if d.SkipVerify {
client.Transport = &http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
}
}
client.Timeout = httpTimoutSecond
resp, err := client.Do(req)
if err != nil {
Expand Down