Documentation ¶
Index ¶
- Variables
- type PrepareRequest
- func (pr *PrepareRequest) Prepare(method, url string, params *url.Params, headers *http.Header, ...) error
- func (pr *PrepareRequest) Prepare_auth(auth []string, rawurl string) error
- func (pr *PrepareRequest) Prepare_body(data *url.Values, files *url.Files, json map[string]interface{}) error
- func (pr *PrepareRequest) Prepare_cookies(cookies *cookiejar.Jar)
- func (pr *PrepareRequest) Prepare_headers(headers *http.Header) error
- func (pr *PrepareRequest) Prepare_method(method string) error
- func (pr *PrepareRequest) Prepare_url(rawurl string, params *url.Params) error
- type Request
- type Response
- func (r *Response) Get() (string, bool)
- func (r *Response) Getall() []string
- func (res *Response) GoJson(path string) string
- func (res *Response) Json() (map[string]interface{}, error)
- func (res *Response) RaiseForStatus() error
- func (r *Response) SaveFile(filename string) error
- func (res *Response) SimpleJson() (*simplejson.Json, error)
- func (r *Response) Xpath(expr string) *Response
Constants ¶
This section is empty.
Variables ¶
View Source
var MethodNames = []string{http.MethodGet, http.MethodPost, http.MethodOptions, http.MethodHead, http.MethodPut, http.MethodPatch, http.MethodDelete, http.MethodConnect, http.MethodTrace}
HTTP的所有请求方法
Functions ¶
This section is empty.
Types ¶
type PrepareRequest ¶
type PrepareRequest struct { Method string Url string Headers *http.Header Cookies *cookiejar.Jar Body io.ReadCloser }
PrepareRequest结构体
func NewPrepareRequest ¶
func NewPrepareRequest() *PrepareRequest
func (*PrepareRequest) Prepare ¶
func (pr *PrepareRequest) Prepare(method, url string, params *url.Params, headers *http.Header, cookies *cookiejar.Jar, data *url.Values, files *url.Files, json map[string]interface{}, auth []string) error
预处理所有数据
func (*PrepareRequest) Prepare_auth ¶
func (pr *PrepareRequest) Prepare_auth(auth []string, rawurl string) error
预处理auth
func (*PrepareRequest) Prepare_body ¶
func (pr *PrepareRequest) Prepare_body(data *url.Values, files *url.Files, json map[string]interface{}) error
预处理body
func (*PrepareRequest) Prepare_cookies ¶
func (pr *PrepareRequest) Prepare_cookies(cookies *cookiejar.Jar)
预处理cookie
func (*PrepareRequest) Prepare_headers ¶
func (pr *PrepareRequest) Prepare_headers(headers *http.Header) error
预处理headers
func (*PrepareRequest) Prepare_method ¶
func (pr *PrepareRequest) Prepare_method(method string) error
预处理method
func (*PrepareRequest) Prepare_url ¶
func (pr *PrepareRequest) Prepare_url(rawurl string, params *url.Params) error
预处理url
type Request ¶
type Request struct { Method string Url string Params *url.Params Headers *http.Header Cookies *cookiejar.Jar Data *url.Values Files *url.Files Json map[string]interface{} Auth []string }
func (*Request) Prepare ¶
func (req *Request) Prepare() *PrepareRequest
Click to show internal directories.
Click to hide internal directories.