Versions in this module Expand all Collapse all v0 v0.22.0 Dec 27, 2025 Changes in this version + const DefaultMaxResponseSize + const DefaultTimeout + const DefaultUserAgent + var ErrBodyAlreadyUsed = errors.New("body has already been consumed") + var ErrFetchTimeout = errors.New("fetch request timed out") + var ErrHostBlocked = errors.New("host is blocked") + var ErrHostNotAllowed = errors.New("host not in allowed list") + var ErrInsecureNotAllowed = errors.New("insecure HTTP not allowed") + var ErrInvalidURL = errors.New("invalid URL") + var ErrNetworkFailure = errors.New("network error") + var ErrPrivateNetworkNotAllowed = errors.New("private network access not allowed") + var ErrRedirectNotAllowed = errors.New("redirects not allowed") + var ErrResponseTooLarge = errors.New("response body exceeds maximum allowed size") + func ParseStatusTextFromHeader(status string) string + type EventLoop interface + RegisterCallback func() func(func()) + Runtime func() *goja.Runtime + type Fetch struct + func NewFetchModule(loop EventLoop, config *FetchConfig) *Fetch + func NewFetchModuleFromConfig(loop EventLoop, cfg *config.FetchConfig) (*Fetch, error) + func (m *Fetch) Register() + type FetchConfig struct + AllowInsecure bool + AllowPrivateNetworks bool + AllowedHosts []string + BlockedHosts []string + DefaultTimeout time.Duration + HTTPClient *http.Client + MaxResponseSize int64 + UserAgent string + func DefaultFetchConfig() *FetchConfig + func (c *FetchConfig) ValidateURL(rawURL string) error + type Headers struct + func NewHeaders(vm *goja.Runtime) *Headers + func NewHeadersFromHTTP(vm *goja.Runtime, h http.Header) *Headers + func NewHeadersFromObject(vm *goja.Runtime, obj *goja.Object) *Headers + func (h *Headers) ToGojaObject() *goja.Object + func (h *Headers) ToHTTPHeader() http.Header + type Response struct + func NewResponse(vm *goja.Runtime, init ResponseInit) *Response + func (r *Response) SetPromiseConstructor(ctor goja.Value) + func (r *Response) ToGojaObject() *goja.Object + type ResponseInit struct + Body []byte + Headers *Headers + Redirected bool + Status int + StatusText string + URL string