http

package
v1.0.15 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultClient = NewClient(30 * time.Second)

DefaultClient with 30s timeout

Functions

func GetScanner

func GetScanner(ctx context.Context, url string) (*bufio.Scanner, func(), error)

GetScanner performs a GET request using the default client

Types

type Client

type Client struct {
	*http.Client
}

Client wraps http.Client with convenience methods

func NewClient

func NewClient(timeout time.Duration) *Client

NewClient creates a new HTTP client with default timeout

func (*Client) Get

func (c *Client) Get(ctx context.Context, url string) (*http.Response, error)

Get performs a GET request and returns the response

func (*Client) GetBody

func (c *Client) GetBody(ctx context.Context, url string) (io.ReadCloser, error)

GetBody performs a GET request and returns the response body as io.ReadCloser

func (*Client) GetScanner

func (c *Client) GetScanner(ctx context.Context, url string) (*bufio.Scanner, func(), error)

GetScanner performs a GET request and returns a scanner for line-by-line reading

type Error

type Error struct {
	StatusCode int
	URL        string
}

Error represents an HTTP error

func (*Error) Error

func (e *Error) Error() string

Jump to

Keyboard shortcuts

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