http

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2024 License: MIT Imports: 14 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddHttpPrefix

func AddHttpPrefix(url string) string

AddHttpPrefix 添加http前缀

func AddHttpsPrefix

func AddHttpsPrefix(url string) string

AddHttpsPrefix 添加https前缀

func ClearHttpPrefix

func ClearHttpPrefix(url string) string

ClearHttpPrefix 清除http前缀

func Download added in v0.14.0

func Download(url string, savePath string, requestTimeout int, proxyAddr string) error

Download 下载文件到本地

func Get

func Get(url string, body any, requestTimeout int) (string, int, error)

Get http get

func GetDomain added in v0.9.0

func GetDomain(url string) string

GetDomain 从URL中获取Domain部份

func GetFormWithoutBody

func GetFormWithoutBody(url string, requestTimeout int) (string, int, error)

GetFormWithoutBody http get,application/x-www-form-urlencoded,

func GetJson

func GetJson[TReturn any](url string, body any, requestTimeout int) (TReturn, error)

GetJson Post方式将结果反序列化成TReturn

func NewClient

func NewClient(url string) *client

NewClient 创建Client客户端

func Post

func Post(url string, head map[string]any, body any, contentType string, requestTimeout int) (string, int, error)

Post http post,支持请求超时设置,单位:ms

func PostForm

func PostForm(url string, head map[string]any, body any, requestTimeout int) (string, int, error)

PostForm http post,application/x-www-form-urlencoded

func PostFormWithoutBody

func PostFormWithoutBody(url string, head map[string]any, requestTimeout int) (string, int, error)

PostFormWithoutBody http post,application/x-www-form-urlencoded

func PostJson

func PostJson[TReturn any](url string, head map[string]any, body any, requestTimeout int) (TReturn, int, error)

PostJson Post方式将结果反序列化成TReturn

func RequestProxy added in v0.14.0

func RequestProxy(methodName string, requestUrl string, head map[string]any, body any, contentType string, requestTimeout int, proxyAddr string) (string, int, error)

RequestProxy 支持请求超时设置,单位:ms

Types

This section is empty.

Jump to

Keyboard shortcuts

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