Documentation ¶
Overview ¶
Package curl 封装go 标准http 库使其支持类似curl 的调用
Index ¶
- Constants
- type Client
- type Request
- func (r *Request) SetHeader(key, value string)
- func (r *Request) String() string
- func (r *Request) WithBasicAuth(username, passwd string) error
- func (r *Request) WithBearerAuth(token string) error
- func (r *Request) WithJSONBody(content interface{}) error
- func (r *Request) WithQuery(v *url.Values) error
- type Response
Constants ¶
View Source
const ( GET = "GET" POST = "POST" PUT = "PUT" PATCH = "PATCH" DELETE = "DELETE" HEAD = "HEAD" OPTIONS = "OPTIONS" )
定义一些基本的curl 请求方法常量映射
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client curl client 对象
func (*Client) EnableCookie ¶ added in v0.4.2
func (c *Client) EnableCookie()
EnableCookie let client auto save cookie in every request
func (*Client) WithBaseURL ¶
WithBaseURL 设置client 的 base url
type Request ¶
Request Request
func (*Request) WithBasicAuth ¶
WithBasicAuth 添加basic auth 认证
func (*Request) WithBearerAuth ¶
WithBearerAuth 添加 bearer auth 认证
func (*Request) WithJSONBody ¶
WithJSONBody 添加一个json 请求体
Click to show internal directories.
Click to hide internal directories.