Documentation
¶
Index ¶
- Constants
- func DealResponse(resp *http.Response) ([]byte, error)
- func Get(ctx context.Context, url string, params map[string]interface{}, ...) (*http.Response, error)
- func NewFormPostRequest(urlStr string, params map[string]interface{}, headers ...map[string]string) (*http.Request, error)
- func NewGetRequest(url string, params map[string]interface{}, headers ...map[string]string) (*http.Request, error)
- func NewJSONPostRequest(url string, params map[string]interface{}, headers ...map[string]string) (*http.Request, error)
- func Post(ctx context.Context, url string, params map[string]interface{}, ...) (*http.Response, error)
- func PostJSON(ctx context.Context, url string, params map[string]interface{}, ...) (*http.Response, error)
- func Request(ctx context.Context, method, url string, params map[string]interface{}, ...) (*http.Response, error)
- type Client
Constants ¶
View Source
const ( ContentTypeJSON = "application/json" ContentTypeForm = "application/x-www-form-urlencoded" )
Variables ¶
This section is empty.
Functions ¶
func Get ¶
func Get(ctx context.Context, url string, params map[string]interface{}, options ...map[string]interface{}) (*http.Response, error)
Get 执行 GET 请求
func NewFormPostRequest ¶
func NewFormPostRequest(urlStr string, params map[string]interface{}, headers ...map[string]string) (*http.Request, error)
NewFormPostRequest 创建一个新的 POST 请求,使用表单数据
func NewGetRequest ¶
func NewGetRequest(url string, params map[string]interface{}, headers ...map[string]string) (*http.Request, error)
NewGetRequest 创建一个新的 GET 请求
func NewJSONPostRequest ¶
func NewJSONPostRequest(url string, params map[string]interface{}, headers ...map[string]string) (*http.Request, error)
NewJSONPostRequest 创建一个新的 POST 请求,使用 JSON 数据
func Post ¶
func Post(ctx context.Context, url string, params map[string]interface{}, options ...map[string]interface{}) (*http.Response, error)
Post 执行 POST 请求,使用表单数据
Types ¶
Click to show internal directories.
Click to hide internal directories.