fetch

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Body

type Body interface {
	io.Reader
	Body() streams.ReadableStream
}

Body represents the Body IDL mixin defined in the fetch API.

type Fetch

type Fetch struct {
	BrowsingContext html.BrowsingContext
}

func New

func New(bc html.BrowsingContext) Fetch

func (Fetch) Fetch

func (f Fetch) Fetch(req Request) (*Response, error)

func (Fetch) FetchAsync

func (f Fetch) FetchAsync(req Request) promise.Promise[*Response]

func (Fetch) NewRequest

func (f Fetch) NewRequest(url string, opts ...RequestOption) Request

type HeaderOption added in v0.9.2

type HeaderOption interface{}

type Headers added in v0.9.2

type Headers http.Header

func (Headers) Append added in v0.9.2

func (h Headers) Append(name, val string)

func (Headers) Delete added in v0.9.2

func (h Headers) Delete(name string)

func (Headers) Get added in v0.9.2

func (h Headers) Get(name string) (string, bool)

func (Headers) Has added in v0.9.2

func (h Headers) Has(name string) bool

func (Headers) Set added in v0.9.2

func (h Headers) Set(name, value string)

type ReadableStream

type ReadableStream struct {
	Reader io.Reader
}

func (ReadableStream) GetReader

func (s ReadableStream) GetReader(opts ...streams.GetReaderOption) streams.Reader

type Reader

type Reader struct {
	Reader io.Reader
	Done   bool
}

func (*Reader) Read

type Request

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

func (*Request) URL

func (r *Request) URL() string

type RequestOption

type RequestOption func(*Request)

func WithBody added in v0.9.2

func WithBody(b io.Reader) RequestOption

func WithMethod added in v0.9.2

func WithMethod(m string) RequestOption

func WithSignal

func WithSignal(s *dom.AbortSignal) RequestOption

type Response

type Response struct {
	io.Reader
	Status  int
	Headers Headers
	// contains filtered or unexported fields
}

func (Response) Body

func (r Response) Body() streams.ReadableStream

Jump to

Keyboard shortcuts

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