Documentation
¶
Index ¶
- Constants
- func Address(req *http.Request) (url string)
- func FormatContentTypeAndCharset(contentType string, charset ...string) string
- func Get(url string, reply interface{}) (err error)
- func HMACSHA1(key, data string) string
- func HMACSHA256(key, data string) string
- func Post(url string, data interface{}, reply interface{}) (err error)
- func Protocol(req *http.Request) string
- func Request(method, url string, data interface{}, headers ...map[string]string) (reply []byte, err error)
- type Client
- func (c *Client) Get(url string, reply interface{}) (err error)
- func (c *Client) Marshal(data any) (b *bytes.Buffer, err error)
- func (c *Client) OAuth(key, secret string, strict ...bool) *OAuth
- func (c *Client) Post(url string, data interface{}, reply interface{}) (err error)
- func (c *Client) Request(method, url string, data any, header ...map[string]string) (reply []byte, err error)
- func (c *Client) Use(m middleware)
- func (c *Client) Verify(req *http.Request, body *bytes.Buffer) (err error)
- type Header
- type OAuth
Constants ¶
View Source
const ( HeaderXForwardedProto = "X-Forwarded-Proto" HeaderXForwardedProtocol = "X-Forwarded-Protocol" HeaderXForwardedSsl = "X-Forwarded-Ssl" HeaderXUrlScheme = "X-Url-Scheme" )
View Source
const Charset = "UTF-8"
View Source
const OAuthSignatureName = "oauth_signature"
Variables ¶
This section is empty.
Functions ¶
func FormatContentTypeAndCharset ¶ added in v0.0.2
func HMACSHA256 ¶ added in v1.2.0
Types ¶
type Client ¶
Client HTTP 客户端 支持中间件链、OAuth 签名、自动 Content-Type 协商
func (*Client) Marshal ¶ added in v1.3.0
Marshal 将数据序列化为 bytes.Buffer 优先处理 []byte / string / io.Reader 零拷贝路径,其余走 Binder 编码
Click to show internal directories.
Click to hide internal directories.