fetch

package
v0.32.4 Latest Latest
Warning

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

Go to latest
Published: May 23, 2024 License: Apache-2.0, MIT Imports: 0 Imported by: 0

README

Fetch

Wrapper for the Fetch API

Upstream

Upstream: https://github.com/marwan-at-work/wasm-fetch

Forked here. This sub-directory (only) is licensed MIT.

Documentation

Overview

Package fetch is a js fetch wrapper that avoids importing net/http.

ctx, cancel := context.WithTimeout(context.Background(), time.Second)
defer cancel()
resp, err := fetch.Fetch("/some/api/call", &fetch.Opts{
	Body:   strings.NewReader(`{"one": "two"}`),
	Method: fetch.MethodPost,
	Signal: ctx,
})

Jump to

Keyboard shortcuts

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