Documentation ¶
Index ¶
- Constants
- Variables
- func CreateClientHTTP(timeout time.Duration, certCA []byte, certClient []byte, keyClient []byte) (*http.Client, error)
- func DeleteHTTP(client *http.Client, url string, header map[string]string, ...) (string, error)
- func GetHTTP(client *http.Client, url string, header map[string]string) (string, error)
- func GetJSON(jsonStr, key string) ([]string, error)
- func GetText(textStr string) (string, error)
- func GetXML(xmlStr, key string) ([]string, error)
- func PostHTTP(client *http.Client, url string, header map[string]string, ...) (string, error)
- func PutHTTP(client *http.Client, url string, header map[string]string, ...) (string, error)
- func SetHeader(header map[string]string) map[string]string
Constants ¶
View Source
const ( UTF8 = "UTF-8" GB18030 = "GB18030" GBK = "GBK" HZGB2312 = "HZGB2312" )
Variables ¶
View Source
var ( ErrIndexOutOfKeys = errors.New("Index out of keys") ErrKeyNotFound = errors.New("Not found for key") ErrNotOneXMLObject = errors.New("Not one XML object") ErrNotOneJSONObject = errors.New("Not one JSON object") )
View Source
var DefaultHeader = map[string]string{
"Connection": "keep-alive",
"Cache-Control": "max-age=0",
"Upgrade-Insecure-Requests": "1",
"User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36",
"Accept": "application/json,text/html,application/xml",
"Accept-Encoding": "gzip, deflate",
"Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8,da;q=0.7,pt;q=0.6,ja;q=0.5",
}
DefaultHeader default header
Functions ¶
func CreateClientHTTP ¶
func CreateClientHTTP(timeout time.Duration, certCA []byte, certClient []byte, keyClient []byte) (*http.Client, error)
CreateClientHTTP create http client
func DeleteHTTP ¶
func DeleteHTTP(client *http.Client, url string, header map[string]string, form map[string]string) (string, error)
DeleteHTTP delete http for request
func PostHTTP ¶
func PostHTTP(client *http.Client, url string, header map[string]string, form map[string]string) (string, error)
PostHTTP post http for request
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.