Documentation ¶
Index ¶
- func OpenDebug()
- type BodyType
- type HttpMethod
- type Request
- func (req *Request) Context(ctx context.Context) *Request
- func (req *Request) Do(resp *Response, opts ...func(*Request, *Response)) error
- func (req *Request) Get(url string) *Request
- func (req *Request) HttpBody(body interface{}) *Request
- func (req *Request) HttpMethod(meth HttpMethod) *Request
- func (req *Request) Post(url string, body interface{}) *Request
- func (req *Request) SetHeader(key, value string) *Request
- func (req *Request) SetRequestType(bt BodyType) *Request
- func (req *Request) SetTimeout(t time.Duration) *Request
- func (req *Request) Url(url string) *Request
- type Response
- type SimpleClient
- type SimpleHttp
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type HttpMethod ¶
type HttpMethod uint8
const ( GET HttpMethod = iota POST PUT DELETE PATCH // 不常使用 HEAD CONNECT OPTIONS TRACE )
func (HttpMethod) String ¶
func (hm HttpMethod) String() string
type Request ¶
type Request struct { Method HttpMethod URL string Header http.Header Body interface{} RequestType BodyType Timeout time.Duration Ctx context.Context }
func NewRequest ¶
func (*Request) HttpMethod ¶
func (req *Request) HttpMethod(meth HttpMethod) *Request
func (*Request) SetRequestType ¶
type Response ¶
func NewDefaultResponse ¶
func NewDefaultResponse(resultStruct interface{}) *Response
func NewJsonResponse ¶
func NewJsonResponse(resultStruct interface{}) *Response
func NewResponse ¶
func NewXmlResponse ¶
func NewXmlResponse(resultStruct interface{}) *Response
type SimpleClient ¶
type SimpleClient struct {
// contains filtered or unexported fields
}
func NewSimpleClient ¶
func NewSimpleClient() *SimpleClient
func (*SimpleClient) SetTimeout ¶
func (sc *SimpleClient) SetTimeout(timeout time.Duration)
Click to show internal directories.
Click to hide internal directories.