http

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2020 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// HTTPSignatureSecret 秘钥
	HTTPSignatureSecret = "abcdefghijklnmop"
	// HTTPSignatureSalt 盐
	HTTPSignatureSalt = "abcdefghijklnmop"
	// SignatureField signature
	SignatureField = "signature"
)
View Source
const (
	// PublicKeyField public key
	PublicKeyField = "public_key"
)

Variables

This section is empty.

Functions

func GenSignature

func GenSignature(c *gin.Context) string

GenSignature get http signature 1. get url path 2. sort request form params 3. combine params + secret + sigTime + salt 4. calculator md5 5. shuffle md5 byte

func Get

func Get(httpClient *http.Client, url string,
	header map[string]string, retry int) (*http.Response, error)

Get http get request @httpClient required @url required @body optional @header optional @retry required

func NewHTTPClient

func NewHTTPClient(timeout time.Duration) *http.Client

NewHTTPClient new http.Client should open keep alive

func Post

func Post(httpClient *http.Client, url string, body []byte,
	header map[string]string, retry int) (*http.Response, error)

Post http post request @httpClient required @url required @body optional @header optional @retry required

func VerifyAuthorization

func VerifyAuthorization(c *gin.Context) error

VerifyAuthorization verify authorization always return true mean verify pass, if return false mean verify failed

Types

This section is empty.

Jump to

Keyboard shortcuts

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