Lens Scripting API

    Class ResponseWearable Only

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

    let response = await this.remoteServiceModule.fetch(request); 
    if (response.ok) {
    let contentType = response.headers.get("Content-Type");
    if (contentType === "application/json") {
    let responseJson = await response.json();
    let username = responseJson.json["user"];

    ...
    }
    }

    Hierarchy (View Summary, Expand)

    Index

    Constructors

    Properties

    bodyUsed: boolean

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

    headers: Headers

    The Headers of the Response.

    ok: boolean

    True if the response returned HTTP Status Code 200 (OK).

    status: number

    The response's HTTP status code. HTTP status code values: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status.

    statusText: string

    The HTTP status code converted to string.

    url: string

    The URL of the Response. This is the final URL obtained after any redirects.

    Methods

    • Retrieve the body as Uint8Array.

      Returns any

    • 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

    • Retrieve the body as a json object.

      Returns any

    • Retrieve the body as a string.

      Returns any

    MMNEPVFCICPMFPCPTTAAATR