Documentation ¶
Index ¶
- Variables
- type Agent
- func (a *Agent) ClearCookie()
- func (a *Agent) DELETE(target string, body io.Reader) (*http.Request, error)
- func (a *Agent) Do(ctx context.Context, req *http.Request) (*http.Response, error)
- func (a *Agent) GET(target string) (*http.Request, error)
- func (a *Agent) NewRequest(method string, target string, body io.Reader) (*http.Request, error)
- func (a *Agent) PATCH(target string, body io.Reader) (*http.Request, error)
- func (a *Agent) POST(target string, body io.Reader) (*http.Request, error)
- func (a *Agent) PUT(target string, body io.Reader) (*http.Request, error)
- func (a *Agent) ProcessHTML(ctx context.Context, r *http.Response, body io.ReadCloser) (Resources, error)
- type AgentOption
- func WithBaseURL(base string) AgentOption
- func WithCloneTransport(trs *http.Transport) AgentOption
- func WithDefaultTransport() AgentOption
- func WithNoCache() AgentOption
- func WithNoCookie() AgentOption
- func WithTimeout(d time.Duration) AgentOption
- func WithTransport(trs *http.Transport) AgentOption
- func WithUserAgent(ua string) AgentOption
- type Cache
- type CacheStore
- type Resource
- type Resources
Constants ¶
This section is empty.
Variables ¶
View Source
var ( DefaultConnections = 10000 DefaultName = "isucandar" DefaultAccept = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8" DefaultRequestTimeout = 1 * time.Second DefaultTLSConfig = &tls.Config{ InsecureSkipVerify: true, } DefaultDialer *net.Dialer DefaultTransport *http.Transport )
View Source
var ( ErrTransportInvalid = errors.New("Specify transport option(WithCloneTransport or WithDefaultTransport)") ErrUnknownContentEncoding = errors.New("Unknown content encoding") )
Functions ¶
This section is empty.
Types ¶
type Agent ¶
type Agent struct { Name string BaseURL *url.URL DefaultAccept string CacheStore CacheStore HttpClient *http.Client }
func NewAgent ¶
func NewAgent(opts ...AgentOption) (*Agent, error)
func (*Agent) ClearCookie ¶
func (a *Agent) ClearCookie()
func (*Agent) NewRequest ¶
type AgentOption ¶
func WithBaseURL ¶
func WithBaseURL(base string) AgentOption
func WithCloneTransport ¶
func WithCloneTransport(trs *http.Transport) AgentOption
func WithDefaultTransport ¶
func WithDefaultTransport() AgentOption
func WithNoCache ¶
func WithNoCache() AgentOption
func WithNoCookie ¶
func WithNoCookie() AgentOption
func WithTimeout ¶
func WithTimeout(d time.Duration) AgentOption
func WithTransport ¶
func WithTransport(trs *http.Transport) AgentOption
func WithUserAgent ¶
func WithUserAgent(ua string) AgentOption
type Cache ¶
type Cache struct { ReqDirectives *cacheobject.RequestCacheDirectives ResDirectives *cacheobject.ResponseCacheDirectives Expires *time.Time Date *time.Time LastModified *time.Time ETag *string Varies []string VariesKey string // contains filtered or unexported fields }
type CacheStore ¶
func NewCacheStore ¶
func NewCacheStore() CacheStore
Click to show internal directories.
Click to hide internal directories.