Creates new instances of APIRequestContext.
Optional
options: { Optional
Optional
baseURL?: stringMethods like
apiRequestContext.get(url[, options])
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.html
http://localhost:3000/foo/
and sending request to ./bar.html
results in
http://localhost:3000/foo/bar.html
http://localhost:3000/foo
(without trailing slash) and navigating to ./bar.html
results in
http://localhost:3000/bar.html
Optional
extraHTTPHeaders?: { An object containing additional HTTP headers to be sent with every request. Defaults to none.
Optional
httpCredentials for HTTP authentication. If no origin is specified, the username and password are sent to any servers upon unauthorized responses.
Optional
origin?: stringRestrain sending http credentials on specific origin (scheme://host:port).
Optional
ignoreHTTPSErrors?: booleanWhether to ignore HTTPS errors when sending network requests. Defaults to false
.
Optional
proxy?: { Network proxy settings.
Optional
bypass?: stringOptional comma-separated domains to bypass proxy, for example ".com, chromium.org, .domain.com"
.
Optional
password?: stringOptional password to use if HTTP proxy requires authentication.
Proxy to be used for all requests. HTTP and SOCKS proxies are supported, for example http://myproxy.com:3128
or
socks5://myproxy.com:3128
. Short form myproxy.com:3128
is considered an HTTP proxy.
Optional
username?: stringOptional username to use if HTTP proxy requires authentication.
Optional
storagePopulates context with given storage state. This option can be used to initialize context with logged-in information obtained via browserContext.storageState([options]) or apiRequestContext.storageState([options]). Either a path to the file with saved storage, or the value returned by one of browserContext.storageState([options]) or apiRequestContext.storageState([options]) methods.
Optional
timeout?: numberMaximum time in milliseconds to wait for the response. Defaults to 30000
(30 seconds). Pass 0
to disable
timeout.
Optional
userSpecific user agent to use in this context.
Generated using TypeDoc
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 playwright.request. For more information see APIRequestContext.