httpx

package
v0.0.0-...-5b13e22 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Delete

func Delete(ctx context.Context, url string, headers map[string]string) (*http.Response, error)

func DownloadFile

func DownloadFile(ctx context.Context, url, filePath string) error

DownloadFile 下载远程文件到本地,支持断点续传

func Get

func Get(ctx context.Context, url string, headers map[string]string) (*http.Response, error)

func GetJsonD

func GetJsonD(ctx context.Context, url string, d any, headers map[string]string) error

func JsonV

func JsonV(resp *http.Response, v any) error

func Post

func Post(ctx context.Context, url string, body io.Reader, headers map[string]string) (*http.Response, error)

Post 发送 JSON POST 请求,支持重试

func PostJsonD

func PostJsonD(ctx context.Context, url string, body io.Reader, d any, headers map[string]string) error

func Request

func Request(ctx context.Context, method string, url string, body io.Reader, headers map[string]string) (*http.Response, error)

func UploadFile

func UploadFile(
	ctx context.Context,
	url string,
	filePath string,
	fieldName string,
	fields map[string]string,
	headers map[string]string,
) (*http.Response, error)

UploadFile 上传单个文件,自动重试,支持自定义字段与 header

Types

This section is empty.

Jump to

Keyboard shortcuts

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