network

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package network retrieves resources for the Growse browser.

Index

Constants

This section is empty.

Variables

View Source
var ErrResponseTooLarge = errors.New("response body is too large")

ErrResponseTooLarge is returned when a response exceeds the configured body-size limit.

Functions

This section is empty.

Types

type Client

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

Client is a size-limited HTTP resource loader.

func NewClient

func NewClient() *Client

NewClient creates a client with production defaults.

func NewClientWithLimits

func NewClientWithLimits(httpClient *http.Client, maxBodyBytes int64) *Client

NewClientWithLimits creates a client with explicit dependencies and limits. It is primarily useful for tests and alternative transports.

func (*Client) Get

func (c *Client) Get(ctx context.Context, resourceURL *url.URL) (*Response, error)

Get retrieves one HTTP(S) resource.

type Response

type Response struct {
	URL         *url.URL
	StatusCode  int
	ContentType string
	Body        []byte
}

Response contains the network metadata needed to construct a browser page.

type StatusError

type StatusError struct {
	Code   int
	Status string
}

StatusError reports a non-successful HTTP response.

func (*StatusError) Error

func (e *StatusError) Error() string

Jump to

Keyboard shortcuts

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