httputils

package
v0.0.0-...-549fefd Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GET    = "GET"
	PUT    = "PUT"
	POST   = "POST"
	DELETE = "DELETE"
)
View Source
const (
	ContentType               = "Content-Type"
	ApplicationJson           = "application/json"
	ApplicationFromUrlencoded = "application/x-www-from-urlencoded"
)

Variables

This section is empty.

Functions

func GetHttpRequest

func GetHttpRequest() *resty.Request

func HttpClient

func HttpClient(method string, url string, payload io.Reader, token string) ([]byte, error)

func HttpClientStatusCode

func HttpClientStatusCode(method string, url string, payload io.Reader, token string) (int, error)

func HttpClientWithBodyAndCode

func HttpClientWithBodyAndCode(method string, url string, payload io.Reader, token string) (int, []byte, error)

func HttpClientWithQueries

func HttpClientWithQueries[T any](method string, url string, payload io.Reader, token string, param T) ([]byte, error)

func HttpClientWithScreen

func HttpClientWithScreen(method string, url string, payload io.Reader) (int, []byte, error)

func HttpGet

func HttpGet(method string, url string) ([]byte, error)

func HttpPost

func HttpPost(url string, data interface{}) (content string, err error)

发送POST请求 url:请求地址,data:POST请求提交的数据,contentType:请求体格式,如:application/json content:请求放回的内容

func NewHttpsClient

func NewHttpsClient() *resty.Client

Types

This section is empty.

Jump to

Keyboard shortcuts

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