http

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2024 License: MIT Imports: 23 Imported by: 1

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 ConvertSocks5 added in v0.15.0

func ConvertSocks5(proxy string) string

ConvertSocks5 如果With.Proxy不是socks5协议,则自动添加socks5协议

func Download added in v0.14.0

func Download(url string, savePath string, head map[string]any, requestTimeout int, proxyAddr string) (map[string]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, map[string]string, error)

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

func RequestProxyConfigure added in v0.15.0

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

Types

This section is empty.

Jump to

Keyboard shortcuts

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