fetch

package
v0.6.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 5, 2024 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

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{
		ErrHTTPError{
			StatusCode: http.StatusUnsupportedMediaType,
			Status:     http.StatusText(http.StatusUnsupportedMediaType),
			Message:    "Unsupported content type",
		},
	}
)

Functions

This section is empty.

Types

type ErrHTTPError

type ErrHTTPError struct {
	StatusCode int
	Status     string
	Message    string
}

func NewHTTPError

func NewHTTPError(resp *http.Response) ErrHTTPError

TODO: Change return value to pointer (or at least make it consistent with UnsupportedContentTypeError)

func (ErrHTTPError) Error

func (e ErrHTTPError) Error() string

func (ErrHTTPError) String

func (e ErrHTTPError) String() string

type Factory

type Factory func() (URLData, error)

type FeedData

type FeedData interface {
	Open(context.Context) error
	Fetch(*nurl.URL) (*resource.Feed, error)
	Close() error
}

type URLData

type URLData interface {
	Open(context.Context) error
	Fetch(*nurl.URL) (*resource.WebPage, error)
	Close() error
}

type UnsupportedContentTypeError

type UnsupportedContentTypeError struct {
	ErrHTTPError
}

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL