Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultClient = newDefaultClient()
DefaultClient default client
Functions ¶
This section is empty.
Types ¶
type Binder ¶
type Binder interface { // Name returns the binding engine name Name() string // Bind binds the passed struct pointer using the specified binding engine. Bind(data []byte, obj interface{}) error }
Binder binder
type Client ¶
Client client
func (*Client) Do ¶
func (c *Client) Do(opts *RequestOptions, interceptors ...ResponseInterceptor) (resp *Response)
Do sends an HTTP request based on RequestOptions and then delegates the response to all specified iterceptors.
type FormData ¶
FormData form data
func (*FormData) MarshalJSON ¶
MarshalJSON implements MarshalJSON method to produce JSON.
type JSONBinder ¶
type JSONBinder struct{}
JSONBinder json binder
func (*JSONBinder) Bind ¶
func (b *JSONBinder) Bind(data []byte, obj interface{}) error
Bind binds the passed struct pointer using json binding engine.
type RequestOptions ¶
type RequestOptions struct { Method string `json:"method,omitempty"` URL string `json:"url,omitempty"` Header http.Header `json:"header,omitempty"` Query url.Values `json:"query,omitempty"` Request interface{} `json:"request,omitempty"` }
RequestOptions request options
type Response ¶
type Response struct { *http.Response Request *RequestOptions Body []byte // contains filtered or unexported fields }
Response response
func (*Response) ShouldBindJSON ¶
ShouldBindJSON is a shortcut for resp.ShouldBindWith(obj, &JSONBinder{}).
func (*Response) ShouldBindWith ¶
ShouldBindWith binds the passed struct pointer using the specified binding engine.
type ResponseInterceptor ¶ added in v0.1.1
ResponseInterceptor intercepts the response. ResponseInterceptor counld be specified as a customize error handler. Errors returned from ResponseInterceptor will be set into Response.err field.