Documentation ¶
Index ¶
- type HTTPClient
- func (c *HTTPClient) AddHeader(name, val string) *HTTPClient
- func (c *HTTPClient) Get(endpoint string) ([]byte, error)
- func (c *HTTPClient) Post(endpoint string, data []byte) ([]byte, error)
- func (c *HTTPClient) SetBaseUrl(baseUrl string) *HTTPClient
- func (c *HTTPClient) SetHeaders(headers map[string]string) *HTTPClient
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HTTPClient ¶
HTTPClient 封装了HTTP客户端的功能
func New ¶
func New() *HTTPClient
func NewUrl ¶
func NewUrl(baseUrl string) *HTTPClient
func (*HTTPClient) AddHeader ¶
func (c *HTTPClient) AddHeader(name, val string) *HTTPClient
func (*HTTPClient) Post ¶
func (c *HTTPClient) Post(endpoint string, data []byte) ([]byte, error)
Post 发送POST请求
func (*HTTPClient) SetBaseUrl ¶
func (c *HTTPClient) SetBaseUrl(baseUrl string) *HTTPClient
func (*HTTPClient) SetHeaders ¶
func (c *HTTPClient) SetHeaders(headers map[string]string) *HTTPClient
Click to show internal directories.
Click to hide internal directories.