Documentation ¶
Index ¶
- type Option
- type OptionFunc
- type Request
- func (req *Request) AsyncDelete(url string, ch chan<- *Response)
- func (req *Request) AsyncGet(url string, ch chan<- *Response)
- func (req *Request) AsyncPatch(url string, ch chan<- *Response)
- func (req *Request) AsyncPost(url string, ch chan<- *Response)
- func (req *Request) AsyncPut(url string, ch chan<- *Response)
- func (req *Request) BasicAuth(username, password string) *Request
- func (req *Request) Body(formValues []byte) *Request
- func (req *Request) Delete(url string) (*Response, error)
- func (req *Request) FormData(formValues map[string]string) *Request
- func (req *Request) Get(url string) (*Response, error)
- func (req *Request) Head(url string) (*Response, error)
- func (req *Request) Headers(headerVals map[string]string) *Request
- func (req *Request) JSON(jsonBody map[string]interface{}) *Request
- func (req *Request) MultipartFormData(formData map[string]string) *Request
- func (req *Request) Options(url string) (*Response, error)
- func (req *Request) Patch(url string) (*Response, error)
- func (req *Request) Post(url string) (*Response, error)
- func (req *Request) Put(url string) (*Response, error)
- func (req *Request) Query(formValues map[string]string) *Request
- func (req *Request) Text(formValues string) *Request
- func (req *Request) Upload(name, file string) *Request
- func (req *Request) Uploads(files map[string]string) *Request
- type Response
- func (res *Response) GetBody() io.Reader
- func (res *Response) GetBodyAsByte() ([]byte, error)
- func (res *Response) GetBodyAsJSONRawMessage() (json.RawMessage, error)
- func (res *Response) GetBodyAsString() (string, error)
- func (res Response) GetBodyWithUnmarshal(v interface{}) error
- func (res *Response) GetResp() *http.Response
- func (res *Response) GetStatusCode() int
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
Option is an interface of request option
type OptionFunc ¶
type OptionFunc func(*Request)
OptionFunc is an implementation of option interface
func SetClient ¶
func SetClient(c *http.Client) OptionFunc
SetClient option sets client c for request
func SetCookieJar ¶
func SetCookieJar(c http.CookieJar) OptionFunc
SetCookieJar option sets cookie c for request
func SetTimeout ¶
func SetTimeout(t time.Duration) OptionFunc
SetTimeout option sets timeout t for request
func SetTransport ¶
func SetTransport(t *http.Transport) OptionFunc
SetTransport option sets Transport t for request
type Request ¶
type Request struct {
// contains filtered or unexported fields
}
Request is a request type
func (*Request) AsyncDelete ¶
AsyncDelete is a asynchronous delete http request
func (*Request) AsyncPatch ¶
AsyncPatch is a asynchronous patch http request
func (*Request) MultipartFormData ¶
MultipartFormData add form data in multipart request
type Response ¶
type Response struct {
// contains filtered or unexported fields
}
Response is a http response struct
func (*Response) GetBodyAsByte ¶
GetBodyAsByte returns response body as byte
func (*Response) GetBodyAsJSONRawMessage ¶
func (res *Response) GetBodyAsJSONRawMessage() (json.RawMessage, error)
GetBodyAsJSONRawMessage returns response body as json.RawMessage
func (*Response) GetBodyAsString ¶
GetBodyAsString returns response body as string
func (Response) GetBodyWithUnmarshal ¶
GetBodyWithUnmarshal unmarshal response body
func (*Response) GetStatusCode ¶
GetStatusCode returns http status code