request

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EncodeURL

func EncodeURL(api string, queries map[string]interface{}) (string, error)

Types

type CommonError

type CommonError struct {
	ErrCode int    `json:"errcode"` // 	错误码
	ErrMSG  string `json:"errmsg"`  // 	错误描述
}

CommonError 微信返回错误信息

func (CommonError) GetResponseError

func (err CommonError) GetResponseError() error

GetResponseError 获取微信服务器错返回误信息

type CommonResult

type CommonResult struct {
	ResultCode int    `json:"resultcode"` // 	错误码
	ResultMsg  string `json:"resultmsg"`  // 	错误描述
}

CommonResult 微信返回错误信息

func (CommonResult) GetResponseError

func (err CommonResult) GetResponseError() error

GetResponseError 获取微信服务器错返回误信息

type ContentType

type ContentType uint

消息返回数据类型

const (
	ContentTypePlain ContentType = iota
	ContentTypeXML
	ContentTypeJSON
)

func (ContentType) String

func (ctp ContentType) String() string

type Request

type Request struct {
	// contains filtered or unexported fields
}

func NewRequest

func NewRequest(http *http.Client, ctp ContentType) *Request

func (*Request) FormPost

func (cli *Request) FormPost(ctx context.Context, url, field, filename string, reader io.Reader, response interface{}) error

func (*Request) FormPostWithFile

func (cli *Request) FormPostWithFile(ctx context.Context, url, field, filename string, response interface{}) error

func (*Request) Get

func (cli *Request) Get(ctx context.Context, url string, response interface{}) error

func (*Request) GetWithBody

func (cli *Request) GetWithBody(ctx context.Context, url string) (*http.Response, error)

func (*Request) Post

func (cli *Request) Post(ctx context.Context, url string, params interface{}, response interface{}) error

func (*Request) PostWithBody

func (cli *Request) PostWithBody(ctx context.Context, url string, params interface{}) (*http.Response, error)

Jump to

Keyboard shortcuts

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