Documentation ¶
Overview ¶
Package http the http JS implementation
Index ¶
- func NewAsyncResponse(vm *goja.Runtime, res *http.Response) goja.Value
- func NewReadableStream(body io.ReadCloser, vm *goja.Runtime, bodyUsed *bool) *goja.Object
- func NewReadableStreamDefaultReader(body io.ReadCloser, vm *goja.Runtime, lock *bool) *goja.Object
- func NewResponse(vm *goja.Runtime, res *http.Response) goja.Value
- type AbortController
- type AbortControllerConstructor
- type AbortSignal
- type AbortSignalModule
- type FetchModule
- type FileData
- type FormData
- func (f *FormData) Append(name string, value any, filename string) (ret goja.Value)
- func (f *FormData) Delete(name string)
- func (f *FormData) Entries() any
- func (f *FormData) Get(name string) any
- func (f *FormData) GetAll(name string) any
- func (f *FormData) Has(name string) bool
- func (f *FormData) Keys() any
- func (f *FormData) Set(name string, value any, filename string)
- func (f *FormData) Values() any
- type FormDataConstructor
- type Http
- func (h *Http) Delete(call goja.FunctionCall, vm *goja.Runtime) goja.Value
- func (h *Http) Get(call goja.FunctionCall, vm *goja.Runtime) goja.Value
- func (h *Http) Head(call goja.FunctionCall, vm *goja.Runtime) goja.Value
- func (h *Http) Patch(call goja.FunctionCall, vm *goja.Runtime) goja.Value
- func (h *Http) Post(call goja.FunctionCall, vm *goja.Runtime) goja.Value
- func (h *Http) Put(call goja.FunctionCall, vm *goja.Runtime) goja.Value
- func (h *Http) Request(call goja.FunctionCall, vm *goja.Runtime) goja.Value
- type Module
- type URLSearchParams
- func (u *URLSearchParams) Append(name, value string)
- func (u *URLSearchParams) Delete(name string)
- func (u *URLSearchParams) Entries() any
- func (u *URLSearchParams) ForEach(call goja.FunctionCall, vm *goja.Runtime) (ret goja.Value)
- func (u *URLSearchParams) Get(name string) any
- func (u *URLSearchParams) GetAll(name string) []string
- func (u *URLSearchParams) Has(name string) bool
- func (u *URLSearchParams) Keys() []string
- func (u *URLSearchParams) Set(name, value string)
- func (u *URLSearchParams) Sort()
- func (u *URLSearchParams) ToString() string
- func (u *URLSearchParams) Values() [][]string
- type URLSearchParamsConstructor
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewAsyncResponse ¶ added in v0.4.2
NewAsyncResponse returns a new async Response
func NewReadableStream ¶ added in v0.4.2
NewReadableStream ReadableStream API https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream
func NewReadableStreamDefaultReader ¶ added in v0.4.2
NewReadableStreamDefaultReader Streams API https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamDefaultReader https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamBYOBReader
Types ¶
type AbortController ¶ added in v0.4.2
type AbortController struct { Signal *AbortSignal Aborted bool Reason string }
AbortController interface represents a controller object that allows you to abort one or more Web requests as and when desired. https://developer.mozilla.org/en-US/docs/Web/API/AbortController.
func (*AbortController) Abort ¶ added in v0.4.2
func (c *AbortController) Abort()
type AbortControllerConstructor ¶ added in v0.4.2
type AbortControllerConstructor struct{}
AbortControllerConstructor AbortController Constructor
func (*AbortControllerConstructor) Exports ¶ added in v0.4.2
func (*AbortControllerConstructor) Exports() any
Exports AbortController Constructor
func (*AbortControllerConstructor) Global ¶ added in v0.4.2
func (*AbortControllerConstructor) Global()
Global it is a global module
type AbortSignal ¶ added in v0.4.0
AbortSignal represents a signal object that allows you to communicate with http request and abort it. https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal
type AbortSignalModule ¶ added in v0.4.2
type AbortSignalModule struct{}
func (*AbortSignalModule) Exports ¶ added in v0.4.2
func (*AbortSignalModule) Exports() any
func (*AbortSignalModule) Global ¶ added in v0.4.2
func (*AbortSignalModule) Global()
type FetchModule ¶ added in v0.4.2
type FetchModule struct{}
FetchModule the global fetch() method starts the process of fetching a resource from the network, returning a promise which is fulfilled once the response is available. https://developer.mozilla.org/en-US/docs/Web/API/fetch
func (*FetchModule) Exports ¶ added in v0.4.2
func (*FetchModule) Exports() any
func (*FetchModule) Global ¶ added in v0.4.2
func (*FetchModule) Global()
type FormData ¶
type FormData struct {
// contains filtered or unexported fields
}
FormData provides a way to construct a set of key/value pairs representing form fields and their values. which can be sent using the http() method and encoding type were set to "multipart/form-data". Implement the https://developer.mozilla.org/en-US/docs/Web/API/FormData
func (*FormData) Append ¶
Append method of the FormData interface appends a new value onto an existing key inside a FormData object, or adds the key if it does not already exist.
func (*FormData) Delete ¶
Delete method of the FormData interface deletes a key and its value(s) from a FormData object.
func (*FormData) Entries ¶
Entries method returns an iterator which iterates through all key/value pairs contained in the FormData.
func (*FormData) Get ¶
Get method of the FormData interface returns the first value associated with a given key from within a FormData object. If you expect multiple values and want all of them, use the getAll() method instead.
func (*FormData) GetAll ¶
GetAll method of the FormData interface returns all the values associated with a given key from within a FormData object.
func (*FormData) Has ¶
Has method of the FormData interface returns whether a FormData object contains a certain key.
func (*FormData) Keys ¶
Keys method returns an iterator which iterates through all keys contained in the FormData. The keys are strings.
type FormDataConstructor ¶ added in v0.4.0
type FormDataConstructor struct{}
FormDataConstructor FormData Constructor
func (*FormDataConstructor) Exports ¶ added in v0.4.0
func (*FormDataConstructor) Exports() any
Exports returns module instance
func (*FormDataConstructor) Global ¶ added in v0.4.0
func (*FormDataConstructor) Global()
Global it is a global module
type Http ¶
type Http struct {
// contains filtered or unexported fields
}
Http module for fetching resources (including across the network).
func (*Http) Post ¶
Post Make a HTTP POST. Send POST with multipart: http.post(url, { body: new FormData({'bytes': new Uint8Array([0]).buffer}) }) Send POST with x-www-form-urlencoded: http.post(url, { body: new URLSearchParams({'key': 'foo', 'value': 'bar'}) }) Send POST with json: http.post(url, { body: {'key': 'foo'} })
type URLSearchParams ¶
type URLSearchParams struct {
// contains filtered or unexported fields
}
The URLSearchParams defines utility methods to work with the query string of a URL, which can be sent using the http() method and encoding type were set to "application/x-www-form-url". Implement the https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams
func (*URLSearchParams) Append ¶
func (u *URLSearchParams) Append(name, value string)
Append method of the URLSearchParams interface appends a specified key/value pair as a new search parameter.
func (*URLSearchParams) Delete ¶
func (u *URLSearchParams) Delete(name string)
Delete method of the URLSearchParams interface deletes the given search parameter and all its associated values, from the list of all search parameters.
func (*URLSearchParams) Entries ¶
func (u *URLSearchParams) Entries() any
Entries method of the URLSearchParams interface returns an iterator allowing iteration through all key/value pairs contained in this object. The iterator returns key/value pairs in the same order as they appear in the query string. The key and value of each pair are string objects.
func (*URLSearchParams) ForEach ¶
func (u *URLSearchParams) ForEach(call goja.FunctionCall, vm *goja.Runtime) (ret goja.Value)
ForEach method of the URLSearchParams interface allows iteration through all values contained in this object via a callback function.
func (*URLSearchParams) Get ¶
func (u *URLSearchParams) Get(name string) any
Get method of the URLSearchParams interface returns the first value associated to the given search parameter.
func (*URLSearchParams) GetAll ¶
func (u *URLSearchParams) GetAll(name string) []string
GetAll method of the URLSearchParams interface returns all the values associated with a given search parameter as an array.
func (*URLSearchParams) Has ¶
func (u *URLSearchParams) Has(name string) bool
Has method of the URLSearchParams interface returns a boolean value that indicates whether a parameter with the specified name exists.
func (*URLSearchParams) Keys ¶
func (u *URLSearchParams) Keys() []string
Keys method of the URLSearchParams interface returns an iterator allowing iteration through all keys contained in this object. The keys are string objects.
func (*URLSearchParams) Set ¶
func (u *URLSearchParams) Set(name, value string)
Set method of the URLSearchParams interface sets the value associated with a given search parameter to the given value. If there were several matching values, this method deletes the others. If the search parameter doesn't exist, this method creates it.
func (*URLSearchParams) Sort ¶
func (u *URLSearchParams) Sort()
Sort method sorts all key/value pairs contained in this object in place and returns undefined.
func (*URLSearchParams) ToString ¶
func (u *URLSearchParams) ToString() string
ToString method of the URLSearchParams interface returns a query string suitable for use in a URL.
func (*URLSearchParams) Values ¶
func (u *URLSearchParams) Values() [][]string
Values method of the URLSearchParams interface returns an iterator allowing iteration through all values contained in this object. The values are string objects.
type URLSearchParamsConstructor ¶ added in v0.4.0
type URLSearchParamsConstructor struct{}
URLSearchParamsConstructor Constructor
func (*URLSearchParamsConstructor) Exports ¶ added in v0.4.0
func (*URLSearchParamsConstructor) Exports() any
Exports instance URLSearchParams module
func (*URLSearchParamsConstructor) Global ¶ added in v0.4.0
func (*URLSearchParamsConstructor) Global()
Global it is a global module