httpx

package
v0.0.17 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 27, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseQuery

func ParseQuery(qr map[string]any) string

ParseQuery 处理结构体转为query参数

Types

type HttpX

type HttpX struct {
	http.Client
	// contains filtered or unexported fields
}

func NewHttpX

func NewHttpX() *HttpX

func (*HttpX) GET

func (h *HttpX) GET(u string) (*http.Response, error)

GET 发起get请求

func (*HttpX) GETWithContext added in v0.0.16

func (h *HttpX) GETWithContext(ctx context.Context, u string) (*http.Response, error)

func (*HttpX) POST

func (h *HttpX) POST(url string, data []byte) (*http.Response, error)

POST 发起post请求

func (*HttpX) POSTWithContext

func (h *HttpX) POSTWithContext(ctx context.Context, url string, data []byte) (*http.Response, error)

POSTWithContext 发起post请求

func (*HttpX) SetBasicAuth

func (h *HttpX) SetBasicAuth(username, password string) *HttpX

SetBasicAuth 将用户名和密码添加到请求头中

req.SetBasicAuth(username, password)

func (*HttpX) SetHeader

func (h *HttpX) SetHeader(headers map[string]string) *HttpX

SetHeader 设置请求头

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL