fetcher

package
v1.208.1 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2024 License: MIT Imports: 6 Imported by: 0

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