forked from edgelaboratories/heimdall
-
Notifications
You must be signed in to change notification settings - Fork 0
/
client.go
26 lines (22 loc) · 834 Bytes
/
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
package heimdall
import (
"io"
"net/http"
)
// Doer interface has the method required to use a type as custom http client.
// The net/*http.Client type satisfies this interface.
type Doer interface {
Do(*http.Request) (*http.Response, error)
}
// Client Is a generic HTTP client interface
type Client interface {
Get(url string, headers http.Header) (*http.Response, error)
Post(url string, body io.Reader, headers http.Header) (*http.Response, error)
Put(url string, body io.Reader, headers http.Header) (*http.Response, error)
Patch(url string, body io.Reader, headers http.Header) (*http.Response, error)
Delete(url string, headers http.Header) (*http.Response, error)
Do(req *http.Request) (*http.Response, error)
SetRetryCount(count int)
SetRetrier(retrier Retriable)
SetCustomHTTPClient(customHTTPClient Doer)
}