fetch

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2021 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Await

func Await(promise js.Value) (resolve js.Value)

Types

type Body

type Body struct {
	js.Value
}

You can use it with a response, a Blob for example.

https://fetch.spec.whatwg.org/#body

func (*Body) Reader

func (b *Body) Reader() io.Reader

Get an array buffer of the Body, and to each call of Read copy the bytes into the destination []byte.

func (*Body) Text

func (b *Body) Text() string

Call text method and resolve the promise.

type Headers

type Headers struct {
	js.Value
}

func (Headers) Get

func (h Headers) Get(name string) string

func (Headers) Map

func (h Headers) Map() (m map[string]string)

type Response

type Response struct {
	Body
	Headers
	Status     int
	StatusText string
	Ok         bool
}

https://fetch.spec.whatwg.org/#response-class

func Fetch

func Fetch(url string) Response

Jump to

Keyboard shortcuts

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