Documentation ¶
Index ¶
- Constants
- type XHttp
- func (c *XHttp) AddHeader(k, v string) *XHttp
- func (c *XHttp) AddHeaders(headerMap map[string]string) *XHttp
- func (c *XHttp) AddParam(k, v string) *XHttp
- func (c *XHttp) AddParams(paramMap map[string]string) *XHttp
- func (c *XHttp) Get() *XHttp
- func (c *XHttp) GetRestBody(url string) (*http.Response, error)
- func (c *XHttp) Method(m string) *XHttp
- func (c *XHttp) Post() *XHttp
- func (c *XHttp) RespGetJsonKey(url string, keys ...string) ([]byte, error)
- func (c *XHttp) RespToJson(url string, j interface{}) error
- func (c *XHttp) RespToJsonByKeys(url string, j interface{}, keys ...string) error
- func (c *XHttp) RespToString(url string) (string, error)
- func (c *XHttp) SetBody(b string) *XHttp
- func (c *XHttp) SetJsonBody(b interface{}) *XHttp
Constants ¶
View Source
const ( ErrorDefault = -iota - 1 //-1 ErrorInvalidUrl ErrorInvalidMethod )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type XHttp ¶
type XHttp struct {
// contains filtered or unexported fields
}
func NewWithOption ¶ added in v0.2.0
NewWithOption
func (*XHttp) AddHeaders ¶
add some http header
func (*XHttp) GetRestBody ¶ added in v0.2.1
get a http response body warning: you must close body at last
func (*XHttp) RespGetJsonKey ¶
get a json's value from http request
func (*XHttp) RespToJson ¶
get all data from http request
func (*XHttp) RespToJsonByKeys ¶
get all data from http request
func (*XHttp) RespToString ¶
get all data from http request
func (*XHttp) SetJsonBody ¶
set the http body by interface make sure marshal ok
Click to show internal directories.
Click to hide internal directories.