func Get(url string) ([]byte, error)
************************* direct calls ***************************
func Post(url string, body []byte) ([]byte, error)
func Put(url string, body string) ([]byte, error)
type Cookies struct {
// contains filtered or unexported fields
}
func (c *Cookies) Cookies(u *url.URL) []*http.Cookie
func (c *Cookies) Print()
func (c *Cookies) SetCookies(u *url.URL, cookies []*http.Cookie)
type HTTP struct {
MetricName string // if not "", will export metrics for this call
// contains filtered or unexported fields
}
func WithAuth(username string, password string) *HTTP
func (h *HTTP) Cookie(name string) *http.Cookie
func (h *HTTP) Cookies() []*http.Cookie
func (h *HTTP) Debugf(format string, args ...interface{})
func (h *HTTP) Delete(url string, body []byte) *HTTPResponse
func (h *HTTP) Get(url string) *HTTPResponse
func (h *HTTP) GetStream(url string) *HTTPResponse
func (h *HTTP) Head(url string) *HTTPResponse
func (h *HTTP) Post(url string, body []byte) *HTTPResponse
func (h *HTTP) Put(url string, body string) *HTTPResponse
func (h *HTTP) SetCreds(username, password string)
func (h *HTTP) SetDebug(b bool)
func (h *HTTP) SetHeader(key string, value string)
func (h *HTTP) SetTimeout(dur time.Duration)
type HTTPIF interface {
Cookie(name string) *http.Cookie
Cookies() []*http.Cookie
Delete(url string, body []byte) *HTTPResponse
Get(url string) *HTTPResponse
GetStream(url string) *HTTPResponse
Head(url string) *HTTPResponse
Post(url string, body []byte) *HTTPResponse
Put(url string, body string) *HTTPResponse
SetHeader(key string, value string)
SetTimeout(dur time.Duration)
SetDebug(b bool)
SetCreds(username, password string)
}
func NewCachingClient(ctx context.Context) HTTPIF
use urlcacher for the url (needs ctx to authenticate)
func NewDirectClient() HTTPIF
retrieve directly from source
type HTTPResponse struct {
// contains filtered or unexported fields
}
func (h *HTTPResponse) AllHeaders() []*header
func (h *HTTPResponse) Body() []byte
func (h *HTTPResponse) BodyReader() io.Reader
func (h *HTTPResponse) Cookies() []*http.Cookie
func (h *HTTPResponse) Error() error
func (h *HTTPResponse) FinalURL() string
the final url (if we followed redirects the last one)
func (h *HTTPResponse) HTTPCode() int
func (h *HTTPResponse) Header(name string) string
func (h *HTTPResponse) IsSuccess() bool
if no error and http code indicates success, return true