Documentation
¶
Overview ¶
Package httputil implements some http utility functions.
Index ¶
- Variables
- func Get(rawURL string) (buf []byte, err error)
- func GetDoc(rawURL string) (doc *html.Node, err error)
- func GetString(rawURL string) (s string, err error)
- func Post(rawURL, bodyType, data string) (buf []byte, err error)
- func PostString(rawURL, bodyType, data string) (s string, err error)
- func SetClient(c *http.Client)
- type Session
Constants ¶
This section is empty.
Variables ¶
View Source
var InsecureClient = &http.Client{ Transport: &http.Transport{ TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, }, }
InsecureClient is a http client which allows https connections with invalid certificates.
Functions ¶
func PostString ¶
PostString issues a POST to the specified URL and returns the response as a string.
Types ¶
type Session ¶
type Session struct { // Cookies used for each session request. Cookies []*http.Cookie // The User-Agent of each session request. The default Go http User-Agent is // used if UserAgent is empty. UserAgent string }
A Session contains the cookies and User-Agent for a series of requests.
func (*Session) Get ¶
Get issues a GET to the specified URL and returns the raw response. The request uses the session's cookies and User-Agent.
func (*Session) GetString ¶
GetString issues a GET to the specified URL and returns the response as a string. The request uses the session's cookies and User-Agent.
Click to show internal directories.
Click to hide internal directories.