http_utils

package module
v0.0.0-...-ae5d2c0 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTPClient

type HTTPClient struct {
	Client *http.Client
}

func NewHTTPClient

func NewHTTPClient() *HTTPClient

func (*HTTPClient) GetByQuery

func (c *HTTPClient) GetByQuery(r *HTTPRequest) ([]byte, error)

GetByQuery 发送一个HTTP GET请求到指定的URL,并附带查询参数

func (*HTTPClient) PostByForm

func (c *HTTPClient) PostByForm(r *HTTPRequest) ([]byte, error)

PostByForm 发送一个带有表单数据的HTTP POST请求到指定的URL

func (*HTTPClient) PostByJson

func (c *HTTPClient) PostByJson(r *HTTPRequest) ([]byte, error)

PostByJson 发送一个带有JSON数据的HTTP POST请求到指定的URL

type HTTPRequest

type HTTPRequest struct {
	APIUrl  string
	Headers map[string]string
	ReqData any
}

HTTPRequest 包含apiUrl和headers

func NewHTTPRequest

func NewHTTPRequest(apiUrl string, headers map[string]string, reqData any) *HTTPRequest

Jump to

Keyboard shortcuts

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