Documentation ¶
Index ¶
Constants ¶
View Source
const (
DefaultUserAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko)" +
" Chrome/107.0.0.0 Safari/537.36 Edg/107.0.1418.42"
)
Variables ¶
View Source
var (
ErrInvalidRequestURL = errors.New("invalid request url, we only support https:// or http://")
)
Functions ¶
func DefaultConfigRoot ¶
DefaultConfigRoot will generate the default config path based on the user and his running environment.
Types ¶
type Client ¶
type Client struct { *resty.Client *Config }
Client is the wrapper for resty.Client we may provide extra method on this wrapper.
func (*Client) CleanCookies ¶
func (c *Client) CleanCookies()
func (*Client) SetDefaultHostname ¶
type Config ¶
type Config struct { HTTPS bool // If the request was under the https of http. Host string // The request host name. UserAgent string // Custom user agent for mocking as the browser client. Proxy string // The proxy address, such as the http://127.0.0.1:7890, socks://127.0.0.1:7890 ConfigRoot string // The root config path for whole bookhunter download service. // The custom redirect function. Redirect resty.RedirectPolicy `json:"-"` }
Config is the basic configuration for creating the client.
func (*Config) ConfigPath ¶
ConfigPath will return a unique path for this download service.
Click to show internal directories.
Click to hide internal directories.