playwright-test-commons - v0.8.0
    Preparing search index...

    Function getBody

    • Asserts a 2xx status, parses the JSON body and disposes the response. Don't add a separate status check next to it.

      Type Parameters

      • T

        the body's type, taken from the response: a client method declared as this.get<ProductList>(...) makes this return a ProductList

      Parameters

      • response: APIResponse<T>

        the response to read

      Returns Promise<T>

      the parsed body

      const body = await getBody(await Products.list());