effect-playwright
    Preparing search index...

    Interface APIResponse

    APIResponse class represents responses returned by apiRequestContext.get(url[, options]) and similar methods.

    interface APIResponse {
        "[asyncDispose]"(): Promise<void>;
        body(): Promise<Buffer<ArrayBufferLike>>;
        dispose(): Promise<void>;
        headers(): { [key: string]: string };
        headersArray(): { name: string; value: string }[];
        json(): Promise<any>;
        ok(): boolean;
        securityDetails(): Promise<
            | {
                issuer?: string;
                protocol?: string;
                subjectName?: string;
                validFrom?: number;
                validTo?: number;
            }
            | null,
        >;
        serverAddr(): Promise<{ ipAddress: string; port: number } | null>;
        status(): number;
        statusText(): string;
        text(): Promise<string>;
        timing(): {
            connectEnd: number;
            connectStart: number;
            domainLookupEnd: number;
            domainLookupStart: number;
            requestStart: number;
            responseEnd: number;
            responseStart: number;
            secureConnectionStart: number;
            startTime: number;
        };
        url(): string;
    }
    Index
    • Returns Promise<void>

    • Returns the buffer with response body.

      Returns Promise<Buffer<ArrayBufferLike>>

    • Disposes the body of this response. If not called then the body will stay in memory until the context closes.

      Returns Promise<void>

    • An object with all the response HTTP headers associated with this response.

      Returns { [key: string]: string }

    • An array with all the response HTTP headers associated with this response. Header names are not lower-cased. Headers with multiple entries, such as Set-Cookie, appear in the array multiple times.

      Returns { name: string; value: string }[]

      • name: string

        Name of the header.

      • value: string

        Value of the header.

    • Returns the JSON representation of response body.

      This method will throw if the response body is not parsable via JSON.parse.

      Returns Promise<any>

    • Contains a boolean stating whether the response was successful (status in the range 200-299) or not.

      Returns boolean

    • Returns SSL and other security information. Resolves to null for non-HTTPS responses. For redirected requests, returns the information for the last request in the redirect chain.

      Returns Promise<
          | {
              issuer?: string;
              protocol?: string;
              subjectName?: string;
              validFrom?: number;
              validTo?: number;
          }
          | null,
      >

    • Returns the IP address and port of the server. Resolves to null if the server address is not available. For redirected requests, returns the information for the last request in the redirect chain.

      Returns Promise<{ ipAddress: string; port: number } | null>

    • Contains the status code of the response (e.g., 200 for a success).

      Returns number

    • Contains the status text of the response (e.g. usually an "OK" for a success).

      Returns string

    • Returns the text representation of response body.

      Returns Promise<string>

    • Returns resource timing information for given response. For redirected requests, returns the information for the last request in the redirect chain. When the response is served from the HAR file, timing information is not available and all the values are -1. Find more information at Resource Timing API.

      Returns {
          connectEnd: number;
          connectStart: number;
          domainLookupEnd: number;
          domainLookupStart: number;
          requestStart: number;
          responseEnd: number;
          responseStart: number;
          secureConnectionStart: number;
          startTime: number;
      }

      • connectEnd: number

        Time immediately after the client establishes the connection to the server to retrieve the resource. The value is given in milliseconds relative to startTime, -1 if not available.

      • connectStart: number

        Time immediately before the client starts establishing the connection to the server to retrieve the resource. The value is given in milliseconds relative to startTime, -1 if not available.

      • domainLookupEnd: number

        Time immediately after the client ends the domain name lookup for the resource. The value is given in milliseconds relative to startTime, -1 if not available.

      • domainLookupStart: number

        Time immediately before the client starts the domain name lookup for the resource. The value is given in milliseconds relative to startTime, -1 if not available.

      • requestStart: number

        Time immediately before the client starts requesting the resource from the server, cache, or local resource. The value is given in milliseconds relative to startTime, -1 if not available.

      • responseEnd: number

        Time immediately after the client receives the last byte of the resource or immediately before the transport connection is closed, whichever comes first. The value is given in milliseconds relative to startTime, -1 if not available.

      • responseStart: number

        Time immediately after the client receives the first byte of the response from the server, cache, or local resource. The value is given in milliseconds relative to startTime, -1 if not available.

      • secureConnectionStart: number

        Time immediately before the client starts the handshake process to secure the current connection. The value is given in milliseconds relative to startTime, -1 if not available.

      • startTime: number

        Request start time in milliseconds elapsed since January 1, 1970 00:00:00 UTC

    • Contains the URL of the response.

      Returns string