Helper module - Helper functions for the main module whatwg-xhr.
- Version:
- 1.0.0
- Source:
Members
(static, constant) corsSafelistedHttpRequestMethod :Set
A CORS-safelisted method is a method that is `GET`, `HEAD`, or `POST`, as defined by WHATWG Fetch Living Standard.
Type:
- Set
- Source:
(static, constant) forbiddenHttpRequestMethod :Set
A forbidden method is a method that is a byte-case-insensitive match for `CONNECT`, `TRACE`, or `TRACK`, as defined by WHATWG Fetch Living Standard..
Type:
- Set
- Source:
(inner, constant) forbiddenRequestHeaderName :Set
Set of forbidden request-headers, as defined by WHATWG Fetch Living Standard.
Type:
- Set
- Source:
Methods
(static) forbiddenRequestHeader(name, value) → {boolean}
To determine if the Http request header given by name and value is forbidden by WHATWG Fetch Living Standard.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | The name of the Http request header. |
value |
string | The value of the Http request header. |
- Source:
Requires:
Returns:
true if the Http request header is forbidden, otherwise false.
- Type
- boolean
(static) safelyExtractBodyWithType(body, keepAlive) → {object}
To return the request body with type, as defined by WHATWG Fetch Living Standard.
Parameters:
Name | Type | Description |
---|---|---|
body |
Blob | ArrayBuffer | Uint8Array | DataView | FormData | URLSearchParams | string | ReadableStream | The request body. |
keepAlive |
boolean | (Optional). |
- Source:
Requires:
Returns:
Request body with type.
- Type
- object
(inner) isFormDataLike(object) → {boolean}
To determine if the given object is an instanceof a FormData constructor.
Parameters:
Name | Type | Description |
---|---|---|
object |
object | The object to check. |
- Source:
Returns:
true if the given object is an instanceof a FormData constructor, otherwise false.
- Type
- boolean
(inner) isXMLHttpRequestBodyInit(body) → {boolean}
To determine the typeof request body, as defined by WHATWG Fetch Living Standard.
Parameters:
Name | Type | Description |
---|---|---|
body |
Blob | ArrayBuffer | Uint8Array | DataView | FormData | URLSearchParams | string | The request body. |
- Source:
Requires:
Returns:
true if the typeof request body is one of the above types, otherwise false.
- Type
- boolean
(inner) isXMLHttpRequestBodyInit(body) → {boolean}
To determine the typeof request body, as defined by WHATWG Fetch Living Standard.
Parameters:
Name | Type | Description |
---|---|---|
body |
Blob | ArrayBuffer | Uint8Array | DataView | FormData | URLSearchParams | string | ReadableStream | The request body. |
- Source:
Returns:
true if the typeof request body is one of the above types, otherwise false.
- Type
- boolean