Documentation ¶
Index ¶
- type HTTPClient
- func (client *HTTPClient) DELETE(url string, header http.Header, data []byte) ([]byte, error)
- func (client *HTTPClient) Delete(url string, header http.Header, data []byte) (*HttpResponse, error)
- func (client *HTTPClient) GET(url string, header http.Header, data []byte) ([]byte, error)
- func (client *HTTPClient) Get(url string, header http.Header, data []byte) (*HttpResponse, error)
- func (client *HTTPClient) GetClient() *http.Client
- func (client *HTTPClient) NewTransPort() *http.Transport
- func (client *HTTPClient) PATCH(url string, header http.Header, data []byte) ([]byte, error)
- func (client *HTTPClient) POST(url string, header http.Header, data []byte) ([]byte, error)
- func (client *HTTPClient) PUT(url string, header http.Header, data []byte) ([]byte, error)
- func (client *HTTPClient) Patch(url string, header http.Header, data []byte) (*HttpResponse, error)
- func (client *HTTPClient) Post(url string, header http.Header, data []byte) (*HttpResponse, error)
- func (client *HTTPClient) Put(url string, header http.Header, data []byte) (*HttpResponse, error)
- func (client *HTTPClient) Request(url, method string, header http.Header, data []byte) ([]byte, error)
- func (client *HTTPClient) RequestEx(url, method string, header http.Header, data []byte) (*HttpResponse, error)
- func (client *HTTPClient) SetBatchHeader(headerSet []*http2.HeaderSet)
- func (client *HTTPClient) SetHeader(key, value string)
- func (client *HTTPClient) SetTLSNoVerity() error
- func (client *HTTPClient) SetTLSVerity(caFile, certFile, keyFile, passwd string) error
- func (client *HTTPClient) SetTLSVerityConfig(tlsConf *tls.Config)
- func (client *HTTPClient) SetTLSVerityServer(caFile string) error
- func (client *HTTPClient) SetTimeOut(timeOut time.Duration)
- type HttpResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HTTPClient ¶
type HTTPClient struct {
// contains filtered or unexported fields
}
HTTPClient define a http client for request.
func (*HTTPClient) Delete ¶
func (client *HTTPClient) Delete(url string, header http.Header, data []byte) (*HttpResponse, error)
Delete do the delete request and return HttpResponse.
func (*HTTPClient) Get ¶
func (client *HTTPClient) Get(url string, header http.Header, data []byte) (*HttpResponse, error)
Get do the get request and return HttpResponse.
func (*HTTPClient) GetClient ¶
func (client *HTTPClient) GetClient() *http.Client
GetClient return the original http.Client.
func (*HTTPClient) NewTransPort ¶
func (client *HTTPClient) NewTransPort() *http.Transport
NewTransPort get a new http transport.
func (*HTTPClient) Patch ¶
func (client *HTTPClient) Patch(url string, header http.Header, data []byte) (*HttpResponse, error)
Patch do the patch request and return HttpResponse.
func (*HTTPClient) Post ¶
func (client *HTTPClient) Post(url string, header http.Header, data []byte) (*HttpResponse, error)
Post do the post request and return HttpResponse.
func (*HTTPClient) Put ¶
func (client *HTTPClient) Put(url string, header http.Header, data []byte) (*HttpResponse, error)
Put do the put request and return HttpResponse.
func (*HTTPClient) Request ¶
func (client *HTTPClient) Request(url, method string, header http.Header, data []byte) ([]byte, error)
Request do request and return body.
func (*HTTPClient) RequestEx ¶
func (client *HTTPClient) RequestEx(url, method string, header http.Header, data []byte) (*HttpResponse, error)
RequestEx do request and return HttpResponse.
func (*HTTPClient) SetBatchHeader ¶
func (client *HTTPClient) SetBatchHeader(headerSet []*http2.HeaderSet)
SetBatchHeader batch set header for the http client。 Note:if the header is the same with the parameter(header) which is specified in the function GET, POST, PUT,DELETE,Patch and so on. this set header is ignore in the call
func (*HTTPClient) SetHeader ¶
func (client *HTTPClient) SetHeader(key, value string)
SetHeader set header for the http client。 Note:if the header is the same with the parameter(header) which is specified in the function GET, POST, PUT,DELETE,Patch and so on. this set header is ignore in the call
func (*HTTPClient) SetTLSNoVerity ¶
func (client *HTTPClient) SetTLSNoVerity() error
SetTLSNoVerity set client TLS insecure skip verify
func (*HTTPClient) SetTLSVerity ¶
func (client *HTTPClient) SetTLSVerity(caFile, certFile, keyFile, passwd string) error
SetTLSVerity set client TLS with certs files.
func (*HTTPClient) SetTLSVerityConfig ¶
func (client *HTTPClient) SetTLSVerityConfig(tlsConf *tls.Config)
SetTLSVerityConfig set client TLS with tls.Config.
func (*HTTPClient) SetTLSVerityServer ¶
func (client *HTTPClient) SetTLSVerityServer(caFile string) error
SetTLSVerityServer set server TLS.
func (*HTTPClient) SetTimeOut ¶
func (client *HTTPClient) SetTimeOut(timeOut time.Duration)
SetTimeout set the client timeout.