Request
ClassRepresents an HTTP request used by the Fetch API in RemoteServiceModule.
- Snapchat: not supported
- SPECS: fully supported
- Camera Kit Web: not supported
- Camera Kit Mobile: not supported
- SnapchatNot supported — Available on SPECS only
- SPECSFully supported
- Camera Kit WebNot supported — Available on SPECS only
- Camera Kit MobileNot supported — Available on SPECS only
Represents an HTTP request used by the Fetch API in RemoteServiceModule.
Index
Example
let request = new Request("https://example.com", {
method: "POST",
body: '{"foo": "bar"}',
});
let url = request.url;
let method = request.method;
let body = request.json();
Extends
Constructors
Constructor
new Request(
input,options?):Request
Parameters
| Parameter | Type |
|---|---|
input | string |
options? | any |
Returns
Request
Overrides
ScriptObject.constructor
Properties
bodyUsed
readonlybodyUsed:boolean
SPECS
True if one of the body retrieval methods has been called for this Request.
headers
readonlyheaders:Headers
SPECS
The Headers of the Request.
method
readonlymethod:string
SPECS
The HTTP request method. Must be one of these strings: GET, POST, PUT, DELETE, or PATCH. Default is GET.
redirect
readonlyredirect:string
SPECS
Indicates how redirects are handled. Can be one the following strings: follow, error, or manual. Default value is follow.
url
readonlyurl:string
SPECS
The URL of the request.
Methods
bytes()
bytes():
Promise<Uint8Array<ArrayBufferLike>>
SPECS
Retreive the body as Uint8Array.
Returns
Promise<Uint8Array<ArrayBufferLike>>
getTypeName()
staticgetTypeName():TypeName<Request>
SPECS
Returns the fully-qualified JavaScript type name for this class (for example, "Component.Camera"). This is a static accessor (no instance required) and returns the same value as the instance getTypeName().
Returns
TypeName<Request>
Overrides
getTypeName()
getTypeName():
string
Returns the name of this object's type.
Returns
string
Inherited from
isOfType()
isOfType(
type):boolean
Returns true if the object matches or derives from the passed in type.
Parameters
| Parameter | Type |
|---|---|
type | string |
Returns
boolean
Inherited from
isSame()
isSame(
other):boolean
Returns true if this object is the same as other. Useful for checking if two references point to the same thing.
Parameters
| Parameter | Type |
|---|---|
other | ScriptObject |
Returns
boolean
Inherited from
json()
json():
Promise<any>
SPECS
Retrieve the body as a json object.
Returns
Promise<any>
text()
text():
Promise<string>
SPECS
Retrieve the body as a string.
Returns
Promise<string>