Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Response ¶
type Response struct {
Status int
StatusText string
Type string
Url string
Headers map[string]string
Ok bool
BodyUsed bool
// contains filtered or unexported fields
}
func (*Response) ArrayBuffer ¶
func (*Response) Json ¶
func (r *FetchResponse) Blob() *goja.Promise {
p, ack, rj := r.engine.NewPromise()
if r.BodyUsed {
rj(http.ErrBodyReadAfterClose)
return p
}
go func() {
defer r.res.Body.Close()
r.BodyUsed = true
bin, err := io.ReadAll(r.res.Body)
if err != nil {
rj(err)
}
ack(r.engine.ToValue(r.engine.NewArrayBuffer(bin)))
}()
return p
}
Click to show internal directories.
Click to hide internal directories.