fetcher

package
v1.187.11 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2024 License: MIT Imports: 6 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseJSON

func ParseJSON[T any](r io.ReadCloser) (T, error)

Types

type Fetcher

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

func NewFetcher

func NewFetcher(server string, opts ...FetcherOption) *Fetcher

func (*Fetcher) Send

func (s *Fetcher) Send(ctx context.Context, method, path string, reqBody any, reqEditors ...RequestEditor) (*http.Response, error)

type FetcherOption

type FetcherOption func(*Fetcher)

func WithBearerToken

func WithBearerToken(token string) FetcherOption

func WithExpectedStatus added in v1.175.1

func WithExpectedStatus(statusCode ...int) FetcherOption

func WithHTTPClient

func WithHTTPClient(client *http.Client) FetcherOption

func WithRequestEditor added in v1.165.1

func WithRequestEditor(fn RequestEditor) FetcherOption

func WithUserAgent

func WithUserAgent(agent string) FetcherOption

type RequestEditor

type RequestEditor func(req *http.Request)

Jump to

Keyboard shortcuts

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