xhr

package
v1.5.8 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2024 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Enable

func Enable(runtime *goja.Runtime, proxyHandler func(r *http.Request) (*url.URL, error)) error

func NewMultipart

func NewMultipart(w io.Writer) *multipartWrapper

Types

type EventProp

type EventProp struct {
	Onload     func(event *ProgressEvent) `json:"onload"`
	Onprogress func(event *ProgressEvent) `json:"onprogress"`
	Onabort    func(event *ProgressEvent) `json:"onabort"`
	Onerror    func(event *ProgressEvent) `json:"onerror"`
	Ontimeout  func(event *ProgressEvent) `json:"ontimeout"`
	// contains filtered or unexported fields
}

func (*EventProp) AddEventListener

func (ep *EventProp) AddEventListener(event string, cb func(event *ProgressEvent))

func (*EventProp) RemoveEventListener

func (ep *EventProp) RemoveEventListener(event string)

type ProgressEvent

type ProgressEvent struct {
	Type             string `json:"type"`
	LengthComputable bool   `json:"lengthComputable"`
	Loaded           int64  `json:"loaded"`
	Total            int64  `json:"total"`
}

type XMLHttpRequest

type XMLHttpRequest struct {
	WithCredentials bool                  `json:"withCredentials"`
	Upload          *XMLHttpRequestUpload `json:"upload"`
	Timeout         int                   `json:"timeout"`
	ReadyState      int                   `json:"readyState"`
	Status          int                   `json:"status"`
	StatusText      string                `json:"statusText"`
	Response        string                `json:"response"`
	ResponseText    string                `json:"responseText"`
	// https://developer.mozilla.org/zh-CN/docs/Web/API/XMLHttpRequest/responseURL
	// https://xhr.spec.whatwg.org/#the-responseurl-attribute
	ResponseUrl string `json:"responseURL"`
	// extend fetch redirect
	// https://developer.mozilla.org/en-US/docs/Web/API/RequestInit#redirect
	// https://fetch.spec.whatwg.org/#concept-request-redirect-mode
	Redirect string `json:"redirect"`
	*EventProp
	Onreadystatechange func(event *ProgressEvent) `json:"onreadystatechange"`
	// contains filtered or unexported fields
}

func (*XMLHttpRequest) Abort

func (xhr *XMLHttpRequest) Abort()

func (*XMLHttpRequest) GetAllResponseHeaders

func (xhr *XMLHttpRequest) GetAllResponseHeaders() string

func (*XMLHttpRequest) GetResponseHeader

func (xhr *XMLHttpRequest) GetResponseHeader(key string) string

func (*XMLHttpRequest) Open

func (xhr *XMLHttpRequest) Open(method, url string)

func (*XMLHttpRequest) Send

func (xhr *XMLHttpRequest) Send(data goja.Value)

func (*XMLHttpRequest) SetRequestHeader

func (xhr *XMLHttpRequest) SetRequestHeader(key, value string)

type XMLHttpRequestUpload

type XMLHttpRequestUpload struct {
	*EventProp
}

Jump to

Keyboard shortcuts

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