forked from projectdiscovery/retryablehttp-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
default_client.go
33 lines (26 loc) · 860 Bytes
/
default_client.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package retryablehttp
import (
"net/http"
"net/url"
)
// DefaultHTTPClient is the http client with DefaultOptionsSingle options.
var DefaultHTTPClient *Client
func init() {
DefaultHTTPClient = NewClient(DefaultOptionsSingle)
}
// Get issues a GET to the specified URL.
func Get(url string) (*http.Response, error) {
return DefaultHTTPClient.Get(url)
}
// Head issues a HEAD to the specified URL.
func Head(url string) (*http.Response, error) {
return DefaultHTTPClient.Head(url)
}
// Post issues a POST to the specified URL.
func Post(url, bodyType string, body interface{}) (*http.Response, error) {
return DefaultHTTPClient.Post(url, bodyType, body)
}
// PostForm issues a POST to the specified URL, with data's keys and values
func PostForm(url string, data url.Values) (*http.Response, error) {
return DefaultHTTPClient.PostForm(url, data)
}