Documentation ¶
Index ¶
- func NewHttpClient() *http.Client
- type RestfulRequest
- func (req *RestfulRequest) AcceptMIME(atype string) error
- func (req *RestfulRequest) ContentType(ctype string, charset string) error
- func (req *RestfulRequest) SetBody(body interface{}, ctype string, charset string) error
- func (req *RestfulRequest) SetBodyString(body string, ctype string, charset string) error
- type RestfulResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewHttpClient ¶
Types ¶
type RestfulRequest ¶
type RestfulRequest struct { Method string Headers map[string]string Params map[string]string Body string Uri string ContentTypeFlag bool AcceptFlag bool CookieJar http.CookieJar }
func NewRestfulRequest ¶
func NewRestfulRequest(method string, uri string) *RestfulRequest
func (*RestfulRequest) AcceptMIME ¶
func (req *RestfulRequest) AcceptMIME(atype string) error
func (*RestfulRequest) ContentType ¶
func (req *RestfulRequest) ContentType(ctype string, charset string) error
func (*RestfulRequest) SetBody ¶
func (req *RestfulRequest) SetBody(body interface{}, ctype string, charset string) error
func (*RestfulRequest) SetBodyString ¶
func (req *RestfulRequest) SetBodyString(body string, ctype string, charset string) error
type RestfulResponse ¶
type RestfulResponse struct { Body string Header *http.Header Cookies []*http.Cookie StatusCode int }
func RestfulCall ¶
func RestfulCall(req *RestfulRequest) (*RestfulResponse, error)
func RestfulCallCore ¶
func RestfulCallCore(client *http.Client, req *RestfulRequest) (*RestfulResponse, error)
func RestfulCallRetry ¶
func RestfulCallRetry(client *http.Client, req *RestfulRequest, retryTimes int, sleepSeconds int) (*RestfulResponse, error)
func (*RestfulResponse) ResponseBody ¶
func (resp *RestfulResponse) ResponseBody() (map[string]interface{}, error)
func (*RestfulResponse) String ¶
func (resp *RestfulResponse) String() string
Click to show internal directories.
Click to hide internal directories.