docs/src/api/class-apirequest.md
Exposes API that can be used for the Web API testing. This class is used for creating
[APIRequestContext] instance which in turn can be used for sending web requests. An instance
of this class can be obtained via [property: Playwright.request]. For more information
see [APIRequestContext].
Creates new instances of [APIRequestContext].
failOnStatusCode <[boolean]>Whether to throw on response codes other than 2xx and 3xx. By default response object is returned for all status codes.
maxRedirects <[int]>Maximum number of request redirects that will be followed automatically. An error will be thrown if the number is exceeded.
Defaults to 20. Pass 0 to not follow redirects. This can be overwritten for each request individually.
timeout <[float]>Maximum time in milliseconds to wait for the response. Defaults to
30000 (30 seconds). Pass 0 to disable timeout.
baseURL <[string]>Methods like [method: APIRequestContext.get] take the base URL into consideration by using the URL() constructor for building the corresponding URL. Examples:
http://localhost:3000 and sending request to /bar.html results in http://localhost:3000/bar.htmlhttp://localhost:3000/foo/ and sending request to ./bar.html results in http://localhost:3000/foo/bar.htmlhttp://localhost:3000/foo (without trailing slash) and navigating to ./bar.html results in http://localhost:3000/bar.htmlstorageState <[path]|[Object]>
cookies <[Array]<[Object]>>
name <[string]>value <[string]>domain <[string]>path <[string]>expires <[float]> Unix time in seconds.httpOnly <[boolean]>secure <[boolean]>sameSite <[SameSiteAttribute]<"Strict"|"Lax"|"None">>origins <[Array]<[Object]>>
origin <[string]>localStorage <[Array]<[Object]>>
name <[string]>value <[string]>Populates context with given storage state. This option can be used to initialize context with logged-in information
obtained via [method: BrowserContext.storageState] or [method: APIRequestContext.storageState]. Either a path to the
file with saved storage, or the value returned by one of [method: BrowserContext.storageState] or
[method: APIRequestContext.storageState] methods.
storageState <[string]>Populates context with given storage state. This option can be used to initialize context with logged-in information
obtained via [method: BrowserContext.storageState] or [method: APIRequestContext.storageState]. Either a path to the
file with saved storage, or the value returned by one of [method: BrowserContext.storageState] or
[method: APIRequestContext.storageState] methods.