fetch

package
v0.0.26 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bytes

func Bytes(resp *http.Response) ([]byte, error)

func CheckStatus

func CheckStatus(resp *http.Response) (*http.Response, error)

func Decode

func Decode(resp *http.Response, target any) error

func Do

func Do(req Request) (*http.Response, error)

func DownloadTo

func DownloadTo(resp *http.Response, box sandbox.Root, path string) error

func Get

func Get(url string) (*http.Response, error)

func Json

func Json[T any](resp *http.Response, sample T) (T, error)

func PathEscape

func PathEscape(value string) string

func Post

func Post(data any, url string) (*http.Response, error)

func QueryEscape

func QueryEscape(value string) string

func SafeGet

func SafeGet(url string) (*http.Response, error)

func SessionDo

func SessionDo(s Session, req Request) (*http.Response, error)

func SessionGet

func SessionGet(s Session, url string) (*http.Response, error)

func SessionPost

func SessionPost(s Session, data any, url string) (*http.Response, error)

func Text

func Text(resp *http.Response) (string, error)

func URLTemplate

func URLTemplate(tmpl string, params map[string]string) (string, error)

func URLWithQuery

func URLWithQuery(baseURL string, params map[string]string) (string, error)

Types

type Request

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

func BasicAuth

func BasicAuth(req Request, username string, password string) Request

func BearerAuth

func BearerAuth(req Request, token string) Request

func Body

func Body(req Request, data any) Request

func FormData

func FormData(req Request, data map[string]string) Request
func Header(req Request, name string, value string) Request

func MaxBodySize

func MaxBodySize(req Request, limit int64) Request

func Method

func Method(req Request, method string) Request

func New

func New(url string) Request

func Retry

func Retry(req Request, maxAttempts int, delayMs int) Request

func Timeout

func Timeout(req Request, durationNs int64) Request

func Transport

func Transport(req Request, t *http.Transport) Request

type Session

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

func NewSession

func NewSession() Session

func SessionHeader

func SessionHeader(s Session, name string, value string) Session

func SessionTimeout

func SessionTimeout(s Session, durationNs int64) Session

func SessionTransport

func SessionTransport(s Session, t *http.Transport) Session

Jump to

Keyboard shortcuts

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