Codebase list golang-github-nlopes-slack / c2edeb3
Merge pull request #73 from lestrrat/master Make the HTTP client accessible from the outside world Norberto Lopes authored 7 years ago GitHub committed 7 years ago
1 changed file(s) with 4 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
1313 "path/filepath"
1414 "time"
1515 )
16
17 var HTTPClient = &http.Client{}
1618
1719 type WebResponse struct {
1820 Ok bool `json:"ok"`
8890
8991 func postWithMultipartResponse(path string, filepath string, values url.Values, intf interface{}, debug bool) error {
9092 req, err := fileUploadReq(SLACK_API+path, filepath, values)
91 client := &http.Client{}
92 resp, err := client.Do(req)
93 resp, err := HTTPClient.Do(req)
9394 if err != nil {
9495 return err
9596 }
9899 }
99100
100101 func postForm(endpoint string, values url.Values, intf interface{}, debug bool) error {
101 resp, err := http.PostForm(endpoint, values)
102 resp, err := HTTPClient.PostForm(endpoint, values)
102103 if err != nil {
103104 return err
104105 }