fetch

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Feb 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 added in v0.0.5

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

func Do

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

func DownloadTo added in v0.0.5

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 added in v0.0.5

func PathEscape(value string) string

func Post

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

func QueryEscape added in v0.0.5

func QueryEscape(value string) string

func SafeGet added in v0.0.8

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 added in v0.0.5

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

func URLWithQuery added in v0.0.5

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 added in v0.0.8

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 added in v0.0.6

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

func Timeout

func Timeout(req Request, durationNs int64) Request

func Transport added in v0.0.5

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 added in v0.0.5

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