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
13 | 13 | "path/filepath" |
14 | 14 | "time" |
15 | 15 | ) |
16 | ||
17 | var HTTPClient = &http.Client{} | |
16 | 18 | |
17 | 19 | type WebResponse struct { |
18 | 20 | Ok bool `json:"ok"` |
88 | 90 | |
89 | 91 | func postWithMultipartResponse(path string, filepath string, values url.Values, intf interface{}, debug bool) error { |
90 | 92 | req, err := fileUploadReq(SLACK_API+path, filepath, values) |
91 | client := &http.Client{} | |
92 | resp, err := client.Do(req) | |
93 | resp, err := HTTPClient.Do(req) | |
93 | 94 | if err != nil { |
94 | 95 | return err |
95 | 96 | } |
98 | 99 | } |
99 | 100 | |
100 | 101 | 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) | |
102 | 103 | if err != nil { |
103 | 104 | return err |
104 | 105 | } |