NewHTTPClient returns the Bitbucket HTTP client. Bitbucket Pipelines reaches the public API through its localhost proxy.
(apiURL string)
| 143 | // NewHTTPClient returns the Bitbucket HTTP client. Bitbucket Pipelines reaches |
| 144 | // the public API through its localhost proxy. |
| 145 | func NewHTTPClient(apiURL string) *http.Client { |
| 146 | if apiURL != APIBaseURL { |
| 147 | return http.DefaultClient |
| 148 | } |
| 149 | proxyURL, err := url.Parse(pipelinesProxyURL) |
| 150 | if err != nil { |
| 151 | return http.DefaultClient |
| 152 | } |
| 153 | return &http.Client{ |
| 154 | Transport: &http.Transport{ |
| 155 | Proxy: http.ProxyURL(proxyURL), |
| 156 | }, |
| 157 | } |
| 158 | } |
| 159 | |
| 160 | func sendPutRequest(client *http.Client, method, url, data string) error { |
| 161 | req, err := http.NewRequest(method, url, bytes.NewBufferString(data)) |
no outgoing calls