httputil

package
v0.0.0-...-4d2a37d Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Ipv4_host_template Ipv4的host模板
	Ipv4_host_template = "%s:%s"
	// Ipv6_host_template Ipv4的host模板
	Ipv6_host_template = "[%s]:%s"
)

Variables

This section is empty.

Functions

func Delete

func Delete(url string, body []byte) (statusCode int, result []byte, err error)

func DeleteWithClient

func DeleteWithClient(client *resty.Client, url string, body []byte) (statusCode int, result []byte, err error)

func DeleteWithResult

func DeleteWithResult(url string, body []byte, result interface{}) (statusCode int, err error)

func FormatHostWithIpAndPort

func FormatHostWithIpAndPort(ip, port string) (string, error)

FormatHostWithIpAndPort 根据指定的ip和端口,格式化一个host(包含了ipv4和ipv6的类型)

func Get

func Get(url string) (int, []byte, error)

func GetDefaultClient

func GetDefaultClient() *resty.Client

func GetIPType

func GetIPType(host string) (string, error)

func GetIpAndPortFromHost

func GetIpAndPortFromHost(host string) (string, string, error)

GetIpAndPortFromHost 从一个包含了ip和端口的host中解析出ip和端口(没有端口的也可以解析,返回的端口为0)

func GetWithClient

func GetWithClient(client *resty.Client, url string) (int, []byte, error)

func GetWithResult

func GetWithResult(url string, result interface{}) (int, error)

func Post

func Post(url string, body []byte) (statusCode int, result []byte, err error)

func PostWithClient

func PostWithClient(client *resty.Client, url string, body []byte) (statusCode int, result []byte, err error)

func PostWithResult

func PostWithResult(url string, body []byte, result interface{}) (statusCode int, err error)

func Put

func Put(url string, body []byte) (statusCode int, result []byte, err error)

func PutWithClient

func PutWithClient(client *resty.Client, url string, body []byte) (statusCode int, result []byte, err error)

func PutWithResult

func PutWithResult(url string, body []byte, result interface{}) (statusCode int, err error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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