request

package
v0.0.0-...-5175aa2 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BaseURL     = "https://api.weixin.qq.com/"
	BaseURLBack = "https://api2.weixin.qq.com/"
)
View Source
const (
	TypeJSON       = "json"
	TypeXML        = "xml"
	TypeUrlencoded = "urlencoded"
	TypeForm       = "form"
	TypeFormData   = "form-data"
	TypeHTML       = "html"
	TypeText       = "text"
	TypeMultipart  = "multipart"
)

Types we support.

Variables

This section is empty.

Functions

func CheckCommonError

func CheckCommonError(body []byte) error

Types

type CommonError

type CommonError struct {
	ErrCode int    `json:"errcode,omitempty"`
	ErrMsg  string `json:"errmsg,omitempty"`
}

type Config

type Config struct {
	//basic config
	AppID     string
	AppSecret string
	AppToken  string

	//message encode
	AesEncodeKey string

	//server callback address
	Callback string
	Timeout  time.Duration
}

type Request

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

func New

func New(c *Config) *Request

func (*Request) Get

func (r *Request) Get(endpoint string, params url.Values) (resp *http.Response, body []byte, err error)

func (*Request) Hijack

func (r *Request) Hijack() *http.Client

func (*Request) Post

func (r *Request) Post(endpoint string, params url.Values, contentType string, bodyReader io.Reader) (resp *http.Response, body []byte, err error)

func (*Request) SetToken

func (r *Request) SetToken(tk string)

Debug

Jump to

Keyboard shortcuts

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