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{}, bodys string) 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
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的所有请求方法
View Source
var PermanentRedirectStatusCodes = []int{
http.StatusMovedPermanently,
http.StatusPermanentRedirect,
}
View Source
var RedirectStatusCodes = []int{
http.StatusMovedPermanently,
http.StatusFound,
http.StatusSeeOther,
http.StatusTemporaryRedirect,
http.StatusPermanentRedirect,
}
Functions ¶
This section is empty.
Types ¶
type PrepareRequest ¶
type PrepareRequest struct { Method string Url string Headers *http.Header Cookies *cookiejar.Jar Body io.Reader }
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{}, body string, 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{}, bodys string) 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 Body string Json map[string]interface{} Auth []string }
func (*Request) Prepare ¶
func (req *Request) Prepare() *PrepareRequest
type Response ¶
type Response struct { Url string Headers http.Header Cookies []*http.Cookie Text string Content []byte Body io.ReadCloser StatusCode int History []*Response Request *url.Request }
Response结构体
func (Response) IsPermanentRedirect ¶
func (Response) IsRedirect ¶
func (*Response) SimpleJson ¶
使用go-simplejson解析
Click to show internal directories.
Click to hide internal directories.