Documentation ¶
Index ¶
Constants ¶
View Source
const (
DefaultTimeout = 30 * time.Second
)
View Source
const (
DefaultUserAgent = "Mozilla/5.0 (X11; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0"
)
Variables ¶
View Source
var ( ErrUnsupportedContentType = UnsupportedContentTypeError{ HttpError{ StatusCode: http.StatusUnsupportedMediaType, Status: http.StatusText(http.StatusUnsupportedMediaType), Message: "Unsupported content type", }, } )
Functions ¶
This section is empty.
Types ¶
type BatchOptions ¶ added in v0.7.0
type BatchOptions struct { }
type BatchURLFetcher ¶ added in v0.7.0
type BatchURLFetcher interface {
Batch([]string, BatchOptions) <-chan *resource.WebPage
}
type Client ¶ added in v0.8.0
type Client interface { Get(url string, headers http.Header) (*http.Response, error) Identifier() resource.FetchClient }
func MustClient ¶ added in v0.8.0
func MustClient(options ...ClientOption) Client
func NewClient ¶ added in v0.8.0
func NewClient(options ...ClientOption) (Client, error)
type ClientOption ¶ added in v0.8.0
type ClientOption func(*defaultClient) error
func WithFiles ¶ added in v0.8.0
func WithFiles(path string) ClientOption
func WithHTTPClient ¶ added in v0.8.0
func WithHTTPClient(client *http.Client) ClientOption
func WithTimeout ¶ added in v0.8.0
func WithTimeout(timeout time.Duration) ClientOption
func WithTransport ¶ added in v0.8.0
func WithTransport(transport http.RoundTripper) ClientOption
func WithUserAgent ¶ added in v0.8.0
func WithUserAgent(ua string) ClientOption
type FeedFetcher ¶ added in v0.6.3
type HttpError ¶ added in v0.6.3
func NewHTTPError ¶
TODO: Resolve/make consistent the pointer/value semantics of this and other errors here.
func (HttpError) Is ¶ added in v0.6.3
We consider the Is test true if the target is an HttpError. For further resolution, check the StatusCode field of the error. TODO: The idea of providing generic and specific HTTPErors is well-intentioned, but the Is checks are a bit baroque (because to make sense these need to work bidrectionally). Consider simplifying.
type URLFetcher ¶ added in v0.6.3
type UnsupportedContentTypeError ¶
type UnsupportedContentTypeError struct {
HttpError
}
func NewUnsupportedContentTypeError ¶
func NewUnsupportedContentTypeError(contentType string) *UnsupportedContentTypeError
func (UnsupportedContentTypeError) Is ¶
func (e UnsupportedContentTypeError) Is(target error) bool
Makes errors.Is(err, ErrUnsupportedContentType) return true for any instance of UnsupportedContentTypeError or for an HttpError with a 415 status code.
Click to show internal directories.
Click to hide internal directories.