Documentation ¶
Overview ¶
Package http authentication and authorization Created by chenguolin 2019-02-11
Package http net/http 封装 Created by chenguolin 2019-02-11
Package http signature Created by chenguolin 2018-11-17
Index ¶
- func GenSignature(c *gin.Context) string
- func Get(httpClient *http.Client, url string, header map[string]string, retry int) (*http.Response, error)
- func NewHTTPClient(timeout time.Duration) *http.Client
- func Post(httpClient *http.Client, url string, body []byte, header map[string]string, ...) (*http.Response, error)
- func VerifyAuthorization(c *gin.Context) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenSignature ¶
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 ¶
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 ¶
VerifyAuthorization verify authorization always return true mean verify pass, if return false mean verify failed
Types ¶
This section is empty.