Documentation
¶
Overview ¶
Package httpx 编码相关
Package httpx http相关 ¶
Package httpx http请求主体 ¶
Package httpx http option ¶
Package httpx http response ¶
Package httpx title ¶
Package httpx provides HTTP utility functions and types for handling user agents
Index ¶
- Constants
- func Decodebig5(s []byte) ([]byte, error)
- func Decodegbk(s []byte) ([]byte, error)
- func DumpRequest(req *retryablehttp.Request) (string, error)
- func DumpRequestRaw(req *retryablehttp.Request) string
- func DumpResponse(resp *http.Response) (string, error)
- func Encodebig5(s []byte) ([]byte, error)
- func ExtractTitle(resp string) (title string)
- func GetRandomUserAgent() string
- func ParseRequest(req string, unsafe bool) (method, path string, headers map[string]string, body string, err error)
- type HTTPOptions
- type HTTPX
- type Response
- type UserAgent
Constants ¶
View Source
const ( // HTTP defines the plain http scheme HTTP = "http" // HTTPS defines the secure http scheme HTTPS = "https" // HTTPorHTTPS defines the both http and https scheme HTTPorHTTPS = "http|https" )
Variables ¶
This section is empty.
Functions ¶
func DumpRequest ¶
func DumpRequest(req *retryablehttp.Request) (string, error)
DumpRequest to string
func GetRandomUserAgent ¶
func GetRandomUserAgent() string
GetRandomUserAgent returns a random user agent string from the predefined list. It uses math/rand to generate a random index.
Types ¶
type HTTPOptions ¶
type HTTPOptions struct {
Timeout time.Duration
RetryMax int
FollowRedirects bool
HTTPProxy string
Unsafe bool
DefaultUserAgent string
Dialer *fastdialer.Dialer
CustomHeaders []string
}
HTTPOptions http options
type HTTPX ¶
type HTTPX struct {
CustomHeaders map[string]string
Options *HTTPOptions
// contains filtered or unexported fields
}
HTTPX represent an instance of the library client
Click to show internal directories.
Click to hide internal directories.