Documentation ¶
Overview ¶
* @Author: cnzf1 * @Date: 2021-07-19 12:00:32 * @LastEditors: cnzf1 * @LastEditTime: 2022-12-14 17:40:38 * @Description:
Index ¶
- func GetIP(r *http.Request) string
- func WithHeaders(headers map[string]string) httpxOption
- func WithJSONContent() httpxOption
- func WithParams(params map[string]string) httpxOption
- type HttpxClient
- func (h *HttpxClient) Get(url string, opts ...httpxOption) ([]byte, error)
- func (h *HttpxClient) GetJSON(url string, opts ...httpxOption) ([]byte, error)
- func (h *HttpxClient) GetToMap(url string, opts ...httpxOption) (map[string]interface{}, error)
- func (h *HttpxClient) GetToMapWithTimeOut(url string, timeout time.Duration, opts ...httpxOption) (map[string]interface{}, error)
- func (h *HttpxClient) GetWithTimeOut(url string, timeout time.Duration, opts ...httpxOption) ([]byte, error)
- func (h *HttpxClient) Post(url string, body interface{}, opts ...httpxOption) ([]byte, error)
- func (h *HttpxClient) PostJSON(url string, body interface{}, opts ...httpxOption) ([]byte, error)
- func (h *HttpxClient) PostToMap(url string, body interface{}, opts ...httpxOption) (map[string]interface{}, error)
- func (h *HttpxClient) PostToMapWithTimeOut(url string, body interface{}, timeout time.Duration, opts ...httpxOption) (map[string]interface{}, error)
- func (h *HttpxClient) PostWithOptions(url string, timeout time.Duration, body interface{}, opts ...httpxOption) ([]byte, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithHeaders ¶
func WithJSONContent ¶
func WithJSONContent() httpxOption
func WithParams ¶
Types ¶
type HttpxClient ¶
type HttpxClient struct {
// contains filtered or unexported fields
}
func Client ¶
func Client() *HttpxClient
func (*HttpxClient) Get ¶
func (h *HttpxClient) Get(url string, opts ...httpxOption) ([]byte, error)
func (*HttpxClient) GetJSON ¶
func (h *HttpxClient) GetJSON(url string, opts ...httpxOption) ([]byte, error)
func (*HttpxClient) GetToMap ¶
func (h *HttpxClient) GetToMap(url string, opts ...httpxOption) (map[string]interface{}, error)
func (*HttpxClient) GetToMapWithTimeOut ¶
func (*HttpxClient) GetWithTimeOut ¶
func (*HttpxClient) Post ¶
func (h *HttpxClient) Post(url string, body interface{}, opts ...httpxOption) ([]byte, error)
func (*HttpxClient) PostJSON ¶
func (h *HttpxClient) PostJSON(url string, body interface{}, opts ...httpxOption) ([]byte, error)
func (*HttpxClient) PostToMap ¶
func (h *HttpxClient) PostToMap(url string, body interface{}, opts ...httpxOption) (map[string]interface{}, error)
func (*HttpxClient) PostToMapWithTimeOut ¶
func (*HttpxClient) PostWithOptions ¶
Click to show internal directories.
Click to hide internal directories.