fetch

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package fetch provides an interface and implementations for fetching remote content.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Fetcher

type Fetcher interface {
	Fetch(ctx context.Context, url string) (*Result, error)
}

Fetcher retrieves content from a URL.

type HTTPFetcher

type HTTPFetcher struct {
	// contains filtered or unexported fields
}

HTTPFetcher fetches content via HTTP GET requests.

func NewHTTPFetcher

func NewHTTPFetcher() *HTTPFetcher

NewHTTPFetcher creates a new HTTP fetcher with a 30-second timeout.

func (*HTTPFetcher) Fetch

func (f *HTTPFetcher) Fetch(ctx context.Context, url string) (*Result, error)

Fetch performs an HTTP GET and returns the response body and content type.

type Result

type Result struct {
	Data        []byte
	ContentType string
}

Result holds the fetched content and its detected content type.

Jump to

Keyboard shortcuts

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