vhttp

package
v0.0.0-...-0b57644 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 3, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ContentTypeJSON        = "application/json"
	ContentTypeXLSX        = "application/xlsx"
	ContentTypeOctetStream = "application/octet-stream"
	ContentTypeUrlencoded  = "application/x-www-form-urlencoded"
)

Variables

This section is empty.

Functions

func GetContentTypeBySuffix

func GetContentTypeBySuffix(suffix string) string

func RequestGet

func RequestGet(reqInfo *HTTPRequest)

func RequestPOST

func RequestPOST(reqInfo *HTTPRequest)

func StatusErrorMsg

func StatusErrorMsg(errcode int) string

func WGet

func WGet(path string, fname string, reqInfo *HTTPRequest) (rets string)

下载文件函数

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
}

HTTPRequest 新的请求结构

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL