httpx

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: Apache-2.0 Imports: 6 Imported by: 2 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Log

type Log struct {
	URL        string
	ReqBody    string
	RespBody   string
	RespStatus string
}

type LogRoundTrip

type LogRoundTrip struct {
	// contains filtered or unexported fields
}

func NewLogRoundTrip

func NewLogRoundTrip(rp http.RoundTripper, log func(l Log, err error)) *LogRoundTrip

func (*LogRoundTrip) RoundTrip

func (l *LogRoundTrip) RoundTrip(request *http.Request) (resp *http.Response, err error)

type Request

type Request struct {
	// contains filtered or unexported fields
}

func NewRequest

func NewRequest(ctx context.Context, method, url string) *Request

func (*Request) AddHeader

func (req *Request) AddHeader(key string, value string) *Request

func (*Request) AddParam

func (req *Request) AddParam(key string, value string) *Request

AddParam 添加查询参数 这个方法性能不好,但是好用

func (*Request) Client

func (req *Request) Client(cli *http.Client) *Request

func (*Request) Do

func (req *Request) Do() *Response

func (*Request) JSONBody

func (req *Request) JSONBody(val any) *Request

JSONBody 使用 JSON body

type Response

type Response struct {
	*http.Response
	// contains filtered or unexported fields
}

func (*Response) JSONScan

func (r *Response) JSONScan(val any) error

JSONScan 将 Body 按照 JSON 反序列化为结构体

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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