Wearable Only
Construct a new Request. Takes a URL and an optional JSON object with options. Available options are body
, method
, headers
, redirect
, and keepalive
.
let request = new Request("https://<Your URL>.com", {
method: "POST",
body: JSON.stringify({ user: { name: "user", career: "developer" }}),
headers: {
"Content-Type": "application/json",
},
});
Optional
options: anyReadonly
bodyTrue if one of the body retrieval methods has been called for this Request.
Readonly
headersThe Headers of the Request.
Readonly
methodThe HTTP request method. Must be one of these strings: GET
, POST
, PUT
, or DELETE
. Default is GET
.
Readonly
redirectIndicates how redirects are handled. Can be one the following strings: follow
, error
, or manual
. Default value is follow
.
Readonly
urlThe URL of the request.
Retreive the body as Uint8Array
.
Returns the name of this object's type.
Returns true if the object matches or derives from the passed in type.
Returns true if this object is the same as other
. Useful for checking if two references point to the same thing.
Retrieve the body as a json object.
Retrieve the body as a string.
Represents an HTTP request used by the Fetch API in RemoteServiceModule.
Example