httpcat

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PostWithTime

func PostWithTime(ctx context.Context, url string, data string, timeout int64) (re []byte)

func Request

func Request(ctx context.Context, url string, method string,
	data string, header map[string]string, timeout int64) (re []byte)

通用http请求

func RequestUrlencoded

func RequestUrlencoded(ctx context.Context, url string, method string, data map[string]string, header map[string]string, timeout int64) (re []byte)

func RequestWithCat

func RequestWithCat(ctx context.Context, urlRaw string, method string,
	data string, header map[string]string, timeout int64, mapData map[string]string) (re []byte)

*

  • 这个方法会返回*http.Response,理论上如果不用,处理方应该手动close掉

func RequestWithResp

func RequestWithResp(ctx context.Context, url string, method string, data string, header map[string]string, timeout int64) (re []byte, response *http.Response)

Types

type Resp

type Resp struct {
	Code int         `json:"code"`
	Msg  string      `json:"msg"`
	Data interface{} `json:"data"`
}

func GetBody

func GetBody(req string) *Resp

Jump to

Keyboard shortcuts

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