Documentation
¶
Index ¶
- type HttpClient
- func (that *HttpClient) Do(data ...[]byte) *HttpClient
- func (that *HttpClient) Get(data ...[]byte) *HttpClient
- func (that *HttpClient) HeaderAdd(key string, value string) *HttpClient
- func (that *HttpClient) HeaderSet(key string, value string) *HttpClient
- func (that *HttpClient) POST(data ...[]byte) *HttpClient
- func (that *HttpClient) Scan(v any) (err error)
- func (that *HttpClient) SetMethod(method string) *HttpClient
- func (that *HttpClient) SetTimeout(timeout int64) *HttpClient
- func (that *HttpClient) SetTransport(transport *http.Transport) *HttpClient
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HttpClient ¶
type HttpClient struct {
Url string
RequestBody []byte
ResponseBody []byte
Header http.Header
Timeout int64 //default time.Second * 60
Transport *http.Transport
Status string // e.g. "200 OK"
StatusCode int // e.g. 200
Err error
Method string
}
func New ¶ added in v1.10.9
func New(url string) *HttpClient
func (*HttpClient) Do ¶ added in v1.10.12
func (that *HttpClient) Do(data ...[]byte) *HttpClient
func (*HttpClient) Get ¶ added in v1.10.9
func (that *HttpClient) Get(data ...[]byte) *HttpClient
func (*HttpClient) HeaderAdd ¶ added in v1.10.9
func (that *HttpClient) HeaderAdd(key string, value string) *HttpClient
Add adds the key, value pair to the header. It appends to any existing values associated with key. The key is case insensitive; it is canonicalized by [CanonicalHeaderKey].
func (*HttpClient) HeaderSet ¶ added in v1.10.17
func (that *HttpClient) HeaderSet(key string, value string) *HttpClient
Get gets the first value associated with the given key. If there are no values associated with the key, Get returns "". It is case insensitive; [textproto.CanonicalMIMEHeaderKey] is used to canonicalize the provided key. Get assumes that all keys are stored in canonical form. To use non-canonical keys, access the map directly.
func (*HttpClient) POST ¶
func (that *HttpClient) POST(data ...[]byte) *HttpClient
func (*HttpClient) Scan ¶ added in v1.10.11
func (that *HttpClient) Scan(v any) (err error)
func (*HttpClient) SetMethod ¶ added in v1.10.12
func (that *HttpClient) SetMethod(method string) *HttpClient
func (*HttpClient) SetTimeout ¶ added in v1.10.9
func (that *HttpClient) SetTimeout(timeout int64) *HttpClient
func (*HttpClient) SetTransport ¶ added in v1.10.9
func (that *HttpClient) SetTransport(transport *http.Transport) *HttpClient
Click to show internal directories.
Click to hide internal directories.