Lens Scripting API
    Preparing search index...

    Class RequestWearable Only

    Represents an HTTP request used by the Fetch API in RemoteServiceModule.

    let request = new Request("https://example.com", {
    method: "POST",
    body: '{"foo": "bar"}',
    });

    let url = request.url;
    let method = request.method;
    let body = request.json();

    Hierarchy (View Summary)

    Index

    Constructors

    • 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://.com", { method: "POST", body: JSON.stringify({ user: { name: "user", career: "developer" }}), headers: { "Content-Type": "application/json", }, });

      
      

      Parameters

      • input: string
      • Optionaloptions: any

      Returns Request

    Properties

    bodyUsed: boolean

    True if one of the body retrieval methods has been called for this Request.

    headers: Headers

    The Headers of the Request.

    method: string

    The HTTP request method. Must be one of these strings: GET, POST, PUT, DELETE, or PATCH. Default is GET.

    redirect: string

    Indicates how redirects are handled. Can be one the following strings: follow, error, or manual. Default value is follow.

    url: string

    The URL of the request.

    Methods

    • Wearable Only

      Retreive the body as Uint8Array.

      Returns Promise<Uint8Array>

    • Returns true if the object matches or derives from the passed in type.

      Parameters

      • type: string

      Returns boolean

    • Returns true if this object is the same as other. Useful for checking if two references point to the same thing.

      Parameters

      Returns boolean

    • Wearable Only

      Retrieve the body as a json object.

      Returns Promise<any>

    • Wearable Only

      Retrieve the body as a string.

      Returns Promise<string>