Documentation
¶
Index ¶
Constants ¶
View Source
const ( ContentTypeJSON = "application/json" ContentTypeXLSX = "application/xlsx" ContentTypeOctetStream = "application/octet-stream" ContentTypeUrlencoded = "application/x-www-form-urlencoded" ContentTypeFormData = "multipart/form-data" )
View Source
const ( HeaderKeyOfResponseCookies = "Set-Cookie" HeaderKeyOfRequestCookies = "Cookie" HeaderKeyOfRequestReferer = "Referer" HeaderKeyOfRequestContentType = "Content-Type" HeaderKeyOfRequestUserAgent = "UserAgent" )
View Source
const (
HTTPStatusOK = http.StatusOK
)
Variables ¶
This section is empty.
Functions ¶
func GET ¶
func GET(reqInfo *HTTPRequest)
func POST ¶
func POST(reqInfo *HTTPRequest)
func StatusErrorMsg ¶
Types ¶
type HTTPRequest ¶
type HTTPRequest struct {
URL string // The URL we just crawled
UserAgent string //指定请求的UserAgent信息
ContentType string // Our content-type
StatusCode int // HTTP code,错误时为-1
RequestBody []byte // The actual page content.
Result []byte //请求结果
InnerErr error // The Error Message
ContentLength int64 //返回的数据长度
ResponseHeader map[string][]string //HTTP请求响应的Header
HeaderCookies string //设置cookies
HeaderReferer string //设置引用
}
HTTPRequest 请求结构
Click to show internal directories.
Click to hide internal directories.