Documentation ¶
Index ¶
- Constants
- Variables
- func NewDefaultClient() *http.Client
- func NewDefaultTransport() *http.Transport
- func ProxyFromEnvironment(req *http.Request) (*url.URL, error)
- type Option
- func WithBasicAuth(username, password string) Option
- func WithBearerTokenAuth(token string) Option
- func WithClient(client *http.Client) Option
- func WithDefaultClient() Option
- func WithDefaultTransport() Option
- func WithHeader(headers ...map[string]string) Option
- func WithProxy(proxy Proxy) Option
- func WithProxyFunc(f func(*http.Request) (*url.URL, error)) Option
- func WithSkipTLSVerify() Option
- func WithTimeout(t time.Duration) Option
- func WithTransport(tr http.RoundTripper) Option
- func WithUnsetProxy() Option
- type Proxy
- type Request
- func (r Request) Content() []byte
- func (r Request) ContentToString() string
- func (r *Request) Delete(originUrl string, data map[string]interface{}) error
- func (r *Request) Download(filePath, originUrl string) error
- func (r *Request) DownloadWithRateLimit(filePath, originUrl string, rate int64) error
- func (r *Request) Get(originUrl string, params map[string]string) error
- func (r *Request) ParseUrl(originUrl string) error
- func (r *Request) Post(originUrl string, data map[string]interface{}) error
- func (r *Request) PostForm(originUrl string, data map[string]string) error
- func (r *Request) Put(originUrl string, data map[string]interface{}) error
- func (r Request) Request() *http.Request
- func (r Request) Response() *http.Response
- func (r *Request) SetBasicAuth(username, password string)
- func (r *Request) SetBearerTokenAuth(token string)
- func (r *Request) SetClient(client *http.Client)
- func (r *Request) SetHeader(header map[string]string)
- func (r *Request) SetProxy(proxy Proxy)
- func (r *Request) SetTimeout(t time.Duration)
- func (r *Request) SetTransport(rt http.RoundTripper)
- func (r *Request) SkipTLSVerify()
- func (r Request) Status() (int, string)
- func (r *Request) UnsetProxy()
- func (r *Request) Upload(originUrl string, data map[string]string, filePaths ...string) error
Constants ¶
View Source
const ( ContentTypeJson = "application/json;charset=utf-8" ContentTypeForm = "application/x-www-form-urlencoded" ProxyHttp = "http" ProxySocks = "socks5" )
Variables ¶
View Source
var DefaultClient = &http.Client{Transport: DefaultTransport}
View Source
var DefaultTransport = http.DefaultTransport.(*http.Transport).Clone()
DefaultTransport is clone of http.DefaultTransport
Functions ¶
func NewDefaultClient ¶ added in v1.2.10
func NewDefaultTransport ¶ added in v1.2.10
Types ¶
type Option ¶ added in v1.1.5
type Option func(*Request)
func WithBasicAuth ¶ added in v1.1.5
func WithBearerTokenAuth ¶ added in v1.1.5
func WithClient ¶ added in v1.2.10
func WithDefaultClient ¶ added in v1.2.10
func WithDefaultClient() Option
func WithDefaultTransport ¶ added in v1.2.10
func WithDefaultTransport() Option
func WithHeader ¶ added in v1.1.5
func WithProxyFunc ¶ added in v1.2.7
func WithSkipTLSVerify ¶ added in v1.1.5
func WithSkipTLSVerify() Option
func WithTimeout ¶ added in v1.1.5
func WithTransport ¶ added in v1.2.4
func WithTransport(tr http.RoundTripper) Option
func WithUnsetProxy ¶ added in v1.2.6
func WithUnsetProxy() Option
type Proxy ¶ added in v1.2.8
func NewHttpProxy ¶ added in v1.2.8
func NewHttpProxyWithAuth ¶ added in v1.2.8
func NewSocksProxy ¶ added in v1.2.8
func NewSocksProxyWithAuth ¶ added in v1.2.8
type Request ¶ added in v1.0.2
type Request struct {
// contains filtered or unexported fields
}
func NewRequest ¶ added in v1.0.2
func NewSession ¶
func (Request) ContentToString ¶ added in v1.1.0
func (*Request) DownloadWithRateLimit ¶ added in v1.1.2
func (*Request) SetBasicAuth ¶ added in v1.0.3
func (*Request) SetBearerTokenAuth ¶ added in v1.0.3
func (*Request) SetTimeout ¶ added in v1.0.3
func (*Request) SetTransport ¶ added in v1.2.3
func (r *Request) SetTransport(rt http.RoundTripper)
func (*Request) SkipTLSVerify ¶ added in v1.0.3
func (r *Request) SkipTLSVerify()
func (*Request) UnsetProxy ¶ added in v1.2.6
func (r *Request) UnsetProxy()
Click to show internal directories.
Click to hide internal directories.