Documentation
¶
Index ¶
- func EncodeFormData(value sobek.Value) (io.Reader, string, error)
- func Fetch(client Client) modules.ModuleFunc
- func InitRequest(rt *sobek.Runtime, url string, value sobek.Value) *http.Request
- func NewClient() *http.Client
- func NewHeader(rt *sobek.Runtime, src http.Header) sobek.Value
- func NewRequest(rt *sobek.Runtime, req *http.Request) sobek.Value
- func NewResponse(rt *sobek.Runtime, res *http.Response) sobek.Value
- func NormalizeHeaderName(name string) string
- func NormalizeHeaderValue(value string) string
- func ToHeader(value sobek.Value) (http.Header, bool)
- func ToRequest(rt *sobek.Runtime, value sobek.Value) (*http.Request, bool)
- func ToResponse(value sobek.Value) (*http.Response, bool)
- type Client
- type CookieJar
- type CookieJarModule
- type FormData
- type Header
- type Headers
- type Request
- type Response
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EncodeFormData ¶
EncodeFormData encodes a FormData object.
func Fetch ¶
func Fetch(client Client) modules.ModuleFunc
Fetch 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 InitRequest ¶
InitRequest builds a http.Request from the RequestInit option
func NewRequest ¶
NewRequest returns a new js Request
func NewResponse ¶
NewResponse returns a new js Response
func NormalizeHeaderName ¶
NormalizeHeaderName normalizes a header name.
func NormalizeHeaderValue ¶
NormalizeHeaderValue LF(0x0A) CR(0x0D) TAB(0x09) SPACE(0x20)
Types ¶
type Client ¶
type Client interface {
// Do sends an HTTP request and returns an HTTP response, following
// policy (such as redirects, cookies, auth) as configured on the
// client.
Do(*http.Request) (*http.Response, error)
}
Client http client interface
type CookieJar ¶
type CookieJar interface {
http.CookieJar
// RemoveCookie delete the cookies for the given URL.
RemoveCookie(u *pkgurl.URL)
}
CookieJar manages storage and use of cookies in HTTP requests. Implementations of CookieJar must be safe for concurrent use by multiple goroutines.
func NewCookieJar ¶
func NewCookieJar() CookieJar
NewCookieJar returns a new CookieJar that will store cookies in in-memory.
type CookieJarModule ¶
type CookieJarModule struct{ CookieJar }
CookieJarModule manages storage and use of cookies in HTTP requests.
func (*CookieJarModule) Instantiate ¶
type FormData ¶
type FormData struct{}
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". https://developer.mozilla.org/en-US/docs/Web/API/FormData
type Headers ¶
type Headers struct{}
Headers allows you to perform various actions on HTTP request and response headers. These actions include retrieving, setting, adding to, and removing headers from the list of the request's headers. https://developer.mozilla.org/en-US/docs/Web/API/Headers
type Request ¶
type Request struct{}
Request interface of the Fetch API represents a resource request. https://developer.mozilla.org/en-US/docs/Web/API/Request/Request