net

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HttpDeleteJson added in v0.0.5

func HttpDeleteJson(sUrl string, params map[string]any, headers ...map[string]string) ([]byte, error)

func HttpGet added in v0.0.5

func HttpGet(sUrl string, headers ...map[string]string) ([]byte, error)

func HttpGetQueryMerge added in v0.0.5

func HttpGetQueryMerge(sUrl string, params map[string]string) (string, error)

HttpGetQueryMerge 合并get请求参数

func HttpPostFile added in v0.0.5

func HttpPostFile(sUrl string, paramName string, fileName string, fileReader io.Reader, params map[string]any, headers map[string]string) ([]byte, error)

HttpPostFile 上传文件

func HttpPostFileEx added in v0.0.5

func HttpPostFileEx(sUrl string, paramName string, fileName string, params map[string]string, headers map[string]string) ([]byte, error)

func HttpPostJson added in v0.0.5

func HttpPostJson(sUrl string, params map[string]any, headers ...map[string]string) ([]byte, error)

HttpPostJson 发送post请求

func HttpPutJson added in v0.0.5

func HttpPutJson(sUrl string, params map[string]any, headers ...map[string]string) ([]byte, error)

func HttpRequest added in v0.0.5

func HttpRequest(method string, sUrl string, body io.Reader, headers ...map[string]string) ([]byte, error)

HttpRequest 发送网络请求

func PostFile added in v0.0.5

func PostFile(filename string, targetUrl string, params map[string]any, headers map[string]string) (string, error)

PostFile 上传文件

Types

type HttpRes

type HttpRes struct {
	ContentType string `json:"contentType"`
	Status      string
	StatusCode  int
	Body        []byte
	Cookies     []*http.Cookie
}

func POST

func POST(url string, params any, cookies []*http.Cookie, handlers ...map[string]string) (*HttpRes, error)

func (*HttpRes) IsError

func (hr *HttpRes) IsError() bool

func (*HttpRes) Text

func (hr *HttpRes) Text() string

func (*HttpRes) Unmarshal

func (hr *HttpRes) Unmarshal(res any) error

Jump to

Keyboard shortcuts

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