feat: update flag to be named apiRequestFailsOnErrorStatus
This commit is contained in:
parent
ee59e0fc96
commit
592829c6d2
|
|
@ -21,7 +21,7 @@ Creates new instances of [APIRequestContext].
|
||||||
### option: APIRequest.newContext.extraHTTPHeaders = %%-context-option-extrahttpheaders-%%
|
### option: APIRequest.newContext.extraHTTPHeaders = %%-context-option-extrahttpheaders-%%
|
||||||
* since: v1.16
|
* since: v1.16
|
||||||
|
|
||||||
### option: APIRequest.newContext.fetchFailOnStatusCode = %%-context-option-fetchFailOnStatusCode-%%
|
### option: APIRequest.newContext.apiRequestFailsOnErrorStatus = %%-context-option-apiRequestFailsOnErrorStatus-%%
|
||||||
* since: v1.51
|
* since: v1.51
|
||||||
|
|
||||||
### option: APIRequest.newContext.httpCredentials = %%-context-option-httpcredentials-%%
|
### option: APIRequest.newContext.httpCredentials = %%-context-option-httpcredentials-%%
|
||||||
|
|
|
||||||
|
|
@ -620,8 +620,8 @@ A list of permissions to grant to all pages in this context. See
|
||||||
|
|
||||||
An object containing additional HTTP headers to be sent with every request. Defaults to none.
|
An object containing additional HTTP headers to be sent with every request. Defaults to none.
|
||||||
|
|
||||||
## context-option-fetchFailOnStatusCode
|
## context-option-apiRequestFailsOnErrorStatus
|
||||||
- `fetchFailOnStatusCode` <[boolean]>
|
- `apiRequestFailsOnErrorStatus` <[boolean]>
|
||||||
|
|
||||||
An object containing an option to throw an error when API request returns status codes other than 2xx and 3xx. By default, response object is returned for all status codes.
|
An object containing an option to throw an error when API request returns status codes other than 2xx and 3xx. By default, response object is returned for all status codes.
|
||||||
|
|
||||||
|
|
@ -970,7 +970,7 @@ between the same pixel in compared images, between zero (strict) and one (lax),
|
||||||
- %%-context-option-locale-%%
|
- %%-context-option-locale-%%
|
||||||
- %%-context-option-permissions-%%
|
- %%-context-option-permissions-%%
|
||||||
- %%-context-option-extrahttpheaders-%%
|
- %%-context-option-extrahttpheaders-%%
|
||||||
- %%-context-option-fetchFailOnStatusCode-%%
|
- %%-context-option-apiRequestFailsOnErrorStatus-%%
|
||||||
- %%-context-option-offline-%%
|
- %%-context-option-offline-%%
|
||||||
- %%-context-option-httpcredentials-%%
|
- %%-context-option-httpcredentials-%%
|
||||||
- %%-context-option-colorscheme-%%
|
- %%-context-option-colorscheme-%%
|
||||||
|
|
|
||||||
|
|
@ -339,7 +339,7 @@ scheme.PlaywrightNewRequestParams = tObject({
|
||||||
userAgent: tOptional(tString),
|
userAgent: tOptional(tString),
|
||||||
ignoreHTTPSErrors: tOptional(tBoolean),
|
ignoreHTTPSErrors: tOptional(tBoolean),
|
||||||
extraHTTPHeaders: tOptional(tArray(tType('NameValue'))),
|
extraHTTPHeaders: tOptional(tArray(tType('NameValue'))),
|
||||||
fetchFailOnStatusCode: tOptional(tBoolean),
|
apiRequestFailsOnErrorStatus: tOptional(tBoolean),
|
||||||
clientCertificates: tOptional(tArray(tObject({
|
clientCertificates: tOptional(tArray(tObject({
|
||||||
origin: tString,
|
origin: tString,
|
||||||
cert: tOptional(tBinary),
|
cert: tOptional(tBinary),
|
||||||
|
|
@ -569,7 +569,7 @@ scheme.BrowserTypeLaunchPersistentContextParams = tObject({
|
||||||
})),
|
})),
|
||||||
permissions: tOptional(tArray(tString)),
|
permissions: tOptional(tArray(tString)),
|
||||||
extraHTTPHeaders: tOptional(tArray(tType('NameValue'))),
|
extraHTTPHeaders: tOptional(tArray(tType('NameValue'))),
|
||||||
fetchFailOnStatusCode: tOptional(tBoolean),
|
apiRequestFailsOnErrorStatus: tOptional(tBoolean),
|
||||||
offline: tOptional(tBoolean),
|
offline: tOptional(tBoolean),
|
||||||
httpCredentials: tOptional(tObject({
|
httpCredentials: tOptional(tObject({
|
||||||
username: tString,
|
username: tString,
|
||||||
|
|
@ -656,7 +656,7 @@ scheme.BrowserNewContextParams = tObject({
|
||||||
})),
|
})),
|
||||||
permissions: tOptional(tArray(tString)),
|
permissions: tOptional(tArray(tString)),
|
||||||
extraHTTPHeaders: tOptional(tArray(tType('NameValue'))),
|
extraHTTPHeaders: tOptional(tArray(tType('NameValue'))),
|
||||||
fetchFailOnStatusCode: tOptional(tBoolean),
|
apiRequestFailsOnErrorStatus: tOptional(tBoolean),
|
||||||
offline: tOptional(tBoolean),
|
offline: tOptional(tBoolean),
|
||||||
httpCredentials: tOptional(tObject({
|
httpCredentials: tOptional(tObject({
|
||||||
username: tString,
|
username: tString,
|
||||||
|
|
@ -726,7 +726,7 @@ scheme.BrowserNewContextForReuseParams = tObject({
|
||||||
})),
|
})),
|
||||||
permissions: tOptional(tArray(tString)),
|
permissions: tOptional(tArray(tString)),
|
||||||
extraHTTPHeaders: tOptional(tArray(tType('NameValue'))),
|
extraHTTPHeaders: tOptional(tArray(tType('NameValue'))),
|
||||||
fetchFailOnStatusCode: tOptional(tBoolean),
|
apiRequestFailsOnErrorStatus: tOptional(tBoolean),
|
||||||
offline: tOptional(tBoolean),
|
offline: tOptional(tBoolean),
|
||||||
httpCredentials: tOptional(tObject({
|
httpCredentials: tOptional(tObject({
|
||||||
username: tString,
|
username: tString,
|
||||||
|
|
@ -2624,7 +2624,7 @@ scheme.AndroidDeviceLaunchBrowserParams = tObject({
|
||||||
})),
|
})),
|
||||||
permissions: tOptional(tArray(tString)),
|
permissions: tOptional(tArray(tString)),
|
||||||
extraHTTPHeaders: tOptional(tArray(tType('NameValue'))),
|
extraHTTPHeaders: tOptional(tArray(tType('NameValue'))),
|
||||||
fetchFailOnStatusCode: tOptional(tBoolean),
|
apiRequestFailsOnErrorStatus: tOptional(tBoolean),
|
||||||
offline: tOptional(tBoolean),
|
offline: tOptional(tBoolean),
|
||||||
httpCredentials: tOptional(tObject({
|
httpCredentials: tOptional(tObject({
|
||||||
username: tString,
|
username: tString,
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ import { TLSSocket } from 'tls';
|
||||||
type FetchRequestOptions = {
|
type FetchRequestOptions = {
|
||||||
userAgent: string;
|
userAgent: string;
|
||||||
extraHTTPHeaders?: HeadersArray;
|
extraHTTPHeaders?: HeadersArray;
|
||||||
fetchFailOnStatusCode?: boolean;
|
apiRequestFailsOnErrorStatus?: boolean;
|
||||||
httpCredentials?: HTTPCredentials;
|
httpCredentials?: HTTPCredentials;
|
||||||
proxy?: ProxySettings;
|
proxy?: ProxySettings;
|
||||||
timeoutSettings: TimeoutSettings;
|
timeoutSettings: TimeoutSettings;
|
||||||
|
|
@ -206,7 +206,7 @@ export abstract class APIRequestContext extends SdkObject {
|
||||||
});
|
});
|
||||||
const fetchUid = this._storeResponseBody(fetchResponse.body);
|
const fetchUid = this._storeResponseBody(fetchResponse.body);
|
||||||
this.fetchLog.set(fetchUid, controller.metadata.log);
|
this.fetchLog.set(fetchUid, controller.metadata.log);
|
||||||
const failOnStatusCode = params.failOnStatusCode !== undefined ? params.failOnStatusCode : !!defaults.fetchFailOnStatusCode;
|
const failOnStatusCode = params.failOnStatusCode !== undefined ? params.failOnStatusCode : !!defaults.apiRequestFailsOnErrorStatus;
|
||||||
if (failOnStatusCode && (fetchResponse.status < 200 || fetchResponse.status >= 400)) {
|
if (failOnStatusCode && (fetchResponse.status < 200 || fetchResponse.status >= 400)) {
|
||||||
let responseText = '';
|
let responseText = '';
|
||||||
if (fetchResponse.body.byteLength) {
|
if (fetchResponse.body.byteLength) {
|
||||||
|
|
@ -612,7 +612,7 @@ export class BrowserContextAPIRequestContext extends APIRequestContext {
|
||||||
return {
|
return {
|
||||||
userAgent: this._context._options.userAgent || this._context._browser.userAgent(),
|
userAgent: this._context._options.userAgent || this._context._browser.userAgent(),
|
||||||
extraHTTPHeaders: this._context._options.extraHTTPHeaders,
|
extraHTTPHeaders: this._context._options.extraHTTPHeaders,
|
||||||
fetchFailOnStatusCode: this._context._options.fetchFailOnStatusCode,
|
apiRequestFailsOnErrorStatus: this._context._options.apiRequestFailsOnErrorStatus,
|
||||||
httpCredentials: this._context._options.httpCredentials,
|
httpCredentials: this._context._options.httpCredentials,
|
||||||
proxy: this._context._options.proxy || this._context._browser.options.proxy,
|
proxy: this._context._options.proxy || this._context._browser.options.proxy,
|
||||||
timeoutSettings: this._context._timeoutSettings,
|
timeoutSettings: this._context._timeoutSettings,
|
||||||
|
|
@ -664,7 +664,7 @@ export class GlobalAPIRequestContext extends APIRequestContext {
|
||||||
baseURL: options.baseURL,
|
baseURL: options.baseURL,
|
||||||
userAgent: options.userAgent || getUserAgent(),
|
userAgent: options.userAgent || getUserAgent(),
|
||||||
extraHTTPHeaders: options.extraHTTPHeaders,
|
extraHTTPHeaders: options.extraHTTPHeaders,
|
||||||
fetchFailOnStatusCode: !!options.fetchFailOnStatusCode,
|
apiRequestFailsOnErrorStatus: !!options.apiRequestFailsOnErrorStatus,
|
||||||
ignoreHTTPSErrors: !!options.ignoreHTTPSErrors,
|
ignoreHTTPSErrors: !!options.ignoreHTTPSErrors,
|
||||||
httpCredentials: options.httpCredentials,
|
httpCredentials: options.httpCredentials,
|
||||||
clientCertificates: options.clientCertificates,
|
clientCertificates: options.clientCertificates,
|
||||||
|
|
|
||||||
60
packages/playwright-core/types/types.d.ts
vendored
60
packages/playwright-core/types/types.d.ts
vendored
|
|
@ -9683,6 +9683,12 @@ export interface Browser {
|
||||||
*/
|
*/
|
||||||
acceptDownloads?: boolean;
|
acceptDownloads?: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An object containing an option to throw an error when API request returns status codes other than 2xx and 3xx. By
|
||||||
|
* default, response object is returned for all status codes.
|
||||||
|
*/
|
||||||
|
apiRequestFailsOnErrorStatus?: boolean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When using [page.goto(url[, options])](https://playwright.dev/docs/api/class-page#page-goto),
|
* When using [page.goto(url[, options])](https://playwright.dev/docs/api/class-page#page-goto),
|
||||||
* [page.route(url, handler[, options])](https://playwright.dev/docs/api/class-page#page-route),
|
* [page.route(url, handler[, options])](https://playwright.dev/docs/api/class-page#page-route),
|
||||||
|
|
@ -9781,12 +9787,6 @@ export interface Browser {
|
||||||
*/
|
*/
|
||||||
extraHTTPHeaders?: { [key: string]: string; };
|
extraHTTPHeaders?: { [key: string]: string; };
|
||||||
|
|
||||||
/**
|
|
||||||
* An object containing an option to throw an error when API request returns status codes other than 2xx and 3xx. By
|
|
||||||
* default, response object is returned for all status codes.
|
|
||||||
*/
|
|
||||||
fetchFailOnStatusCode?: boolean;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Emulates `'forced-colors'` media feature, supported values are `'active'`, `'none'`. See
|
* Emulates `'forced-colors'` media feature, supported values are `'active'`, `'none'`. See
|
||||||
* [page.emulateMedia([options])](https://playwright.dev/docs/api/class-page#page-emulate-media) for more details.
|
* [page.emulateMedia([options])](https://playwright.dev/docs/api/class-page#page-emulate-media) for more details.
|
||||||
|
|
@ -14691,6 +14691,12 @@ export interface BrowserType<Unused = {}> {
|
||||||
*/
|
*/
|
||||||
acceptDownloads?: boolean;
|
acceptDownloads?: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An object containing an option to throw an error when API request returns status codes other than 2xx and 3xx. By
|
||||||
|
* default, response object is returned for all status codes.
|
||||||
|
*/
|
||||||
|
apiRequestFailsOnErrorStatus?: boolean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* **NOTE** Use custom browser args at your own risk, as some of them may break Playwright functionality.
|
* **NOTE** Use custom browser args at your own risk, as some of them may break Playwright functionality.
|
||||||
*
|
*
|
||||||
|
|
@ -14840,12 +14846,6 @@ export interface BrowserType<Unused = {}> {
|
||||||
*/
|
*/
|
||||||
extraHTTPHeaders?: { [key: string]: string; };
|
extraHTTPHeaders?: { [key: string]: string; };
|
||||||
|
|
||||||
/**
|
|
||||||
* An object containing an option to throw an error when API request returns status codes other than 2xx and 3xx. By
|
|
||||||
* default, response object is returned for all status codes.
|
|
||||||
*/
|
|
||||||
fetchFailOnStatusCode?: boolean;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Firefox user preferences. Learn more about the Firefox user preferences at
|
* Firefox user preferences. Learn more about the Firefox user preferences at
|
||||||
* [`about:config`](https://support.mozilla.org/en-US/kb/about-config-editor-firefox).
|
* [`about:config`](https://support.mozilla.org/en-US/kb/about-config-editor-firefox).
|
||||||
|
|
@ -16580,6 +16580,12 @@ export interface AndroidDevice {
|
||||||
*/
|
*/
|
||||||
acceptDownloads?: boolean;
|
acceptDownloads?: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An object containing an option to throw an error when API request returns status codes other than 2xx and 3xx. By
|
||||||
|
* default, response object is returned for all status codes.
|
||||||
|
*/
|
||||||
|
apiRequestFailsOnErrorStatus?: boolean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* **NOTE** Use custom browser args at your own risk, as some of them may break Playwright functionality.
|
* **NOTE** Use custom browser args at your own risk, as some of them may break Playwright functionality.
|
||||||
*
|
*
|
||||||
|
|
@ -16630,12 +16636,6 @@ export interface AndroidDevice {
|
||||||
*/
|
*/
|
||||||
extraHTTPHeaders?: { [key: string]: string; };
|
extraHTTPHeaders?: { [key: string]: string; };
|
||||||
|
|
||||||
/**
|
|
||||||
* An object containing an option to throw an error when API request returns status codes other than 2xx and 3xx. By
|
|
||||||
* default, response object is returned for all status codes.
|
|
||||||
*/
|
|
||||||
fetchFailOnStatusCode?: boolean;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Emulates `'forced-colors'` media feature, supported values are `'active'`, `'none'`. See
|
* Emulates `'forced-colors'` media feature, supported values are `'active'`, `'none'`. See
|
||||||
* [page.emulateMedia([options])](https://playwright.dev/docs/api/class-page#page-emulate-media) for more details.
|
* [page.emulateMedia([options])](https://playwright.dev/docs/api/class-page#page-emulate-media) for more details.
|
||||||
|
|
@ -17425,6 +17425,12 @@ export interface APIRequest {
|
||||||
* @param options
|
* @param options
|
||||||
*/
|
*/
|
||||||
newContext(options?: {
|
newContext(options?: {
|
||||||
|
/**
|
||||||
|
* An object containing an option to throw an error when API request returns status codes other than 2xx and 3xx. By
|
||||||
|
* default, response object is returned for all status codes.
|
||||||
|
*/
|
||||||
|
apiRequestFailsOnErrorStatus?: boolean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Methods like
|
* Methods like
|
||||||
* [apiRequestContext.get(url[, options])](https://playwright.dev/docs/api/class-apirequestcontext#api-request-context-get)
|
* [apiRequestContext.get(url[, options])](https://playwright.dev/docs/api/class-apirequestcontext#api-request-context-get)
|
||||||
|
|
@ -17500,12 +17506,6 @@ export interface APIRequest {
|
||||||
*/
|
*/
|
||||||
extraHTTPHeaders?: { [key: string]: string; };
|
extraHTTPHeaders?: { [key: string]: string; };
|
||||||
|
|
||||||
/**
|
|
||||||
* An object containing an option to throw an error when API request returns status codes other than 2xx and 3xx. By
|
|
||||||
* default, response object is returned for all status codes.
|
|
||||||
*/
|
|
||||||
fetchFailOnStatusCode?: boolean;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Credentials for [HTTP authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication). If no
|
* Credentials for [HTTP authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication). If no
|
||||||
* origin is specified, the username and password are sent to any servers upon unauthorized responses.
|
* origin is specified, the username and password are sent to any servers upon unauthorized responses.
|
||||||
|
|
@ -21901,6 +21901,12 @@ export interface BrowserContextOptions {
|
||||||
*/
|
*/
|
||||||
acceptDownloads?: boolean;
|
acceptDownloads?: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An object containing an option to throw an error when API request returns status codes other than 2xx and 3xx. By
|
||||||
|
* default, response object is returned for all status codes.
|
||||||
|
*/
|
||||||
|
apiRequestFailsOnErrorStatus?: boolean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When using [page.goto(url[, options])](https://playwright.dev/docs/api/class-page#page-goto),
|
* When using [page.goto(url[, options])](https://playwright.dev/docs/api/class-page#page-goto),
|
||||||
* [page.route(url, handler[, options])](https://playwright.dev/docs/api/class-page#page-route),
|
* [page.route(url, handler[, options])](https://playwright.dev/docs/api/class-page#page-route),
|
||||||
|
|
@ -21999,12 +22005,6 @@ export interface BrowserContextOptions {
|
||||||
*/
|
*/
|
||||||
extraHTTPHeaders?: { [key: string]: string; };
|
extraHTTPHeaders?: { [key: string]: string; };
|
||||||
|
|
||||||
/**
|
|
||||||
* An object containing an option to throw an error when API request returns status codes other than 2xx and 3xx. By
|
|
||||||
* default, response object is returned for all status codes.
|
|
||||||
*/
|
|
||||||
fetchFailOnStatusCode?: boolean;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Emulates `'forced-colors'` media feature, supported values are `'active'`, `'none'`. See
|
* Emulates `'forced-colors'` media feature, supported values are `'active'`, `'none'`. See
|
||||||
* [page.emulateMedia([options])](https://playwright.dev/docs/api/class-page#page-emulate-media) for more details.
|
* [page.emulateMedia([options])](https://playwright.dev/docs/api/class-page#page-emulate-media) for more details.
|
||||||
|
|
|
||||||
20
packages/protocol/src/channels.d.ts
vendored
20
packages/protocol/src/channels.d.ts
vendored
|
|
@ -588,7 +588,7 @@ export type PlaywrightNewRequestParams = {
|
||||||
userAgent?: string,
|
userAgent?: string,
|
||||||
ignoreHTTPSErrors?: boolean,
|
ignoreHTTPSErrors?: boolean,
|
||||||
extraHTTPHeaders?: NameValue[],
|
extraHTTPHeaders?: NameValue[],
|
||||||
fetchFailOnStatusCode?: boolean,
|
apiRequestFailsOnErrorStatus?: boolean,
|
||||||
clientCertificates?: {
|
clientCertificates?: {
|
||||||
origin: string,
|
origin: string,
|
||||||
cert?: Binary,
|
cert?: Binary,
|
||||||
|
|
@ -620,7 +620,7 @@ export type PlaywrightNewRequestOptions = {
|
||||||
userAgent?: string,
|
userAgent?: string,
|
||||||
ignoreHTTPSErrors?: boolean,
|
ignoreHTTPSErrors?: boolean,
|
||||||
extraHTTPHeaders?: NameValue[],
|
extraHTTPHeaders?: NameValue[],
|
||||||
fetchFailOnStatusCode?: boolean,
|
apiRequestFailsOnErrorStatus?: boolean,
|
||||||
clientCertificates?: {
|
clientCertificates?: {
|
||||||
origin: string,
|
origin: string,
|
||||||
cert?: Binary,
|
cert?: Binary,
|
||||||
|
|
@ -994,7 +994,7 @@ export type BrowserTypeLaunchPersistentContextParams = {
|
||||||
},
|
},
|
||||||
permissions?: string[],
|
permissions?: string[],
|
||||||
extraHTTPHeaders?: NameValue[],
|
extraHTTPHeaders?: NameValue[],
|
||||||
fetchFailOnStatusCode?: boolean,
|
apiRequestFailsOnErrorStatus?: boolean,
|
||||||
offline?: boolean,
|
offline?: boolean,
|
||||||
httpCredentials?: {
|
httpCredentials?: {
|
||||||
username: string,
|
username: string,
|
||||||
|
|
@ -1075,7 +1075,7 @@ export type BrowserTypeLaunchPersistentContextOptions = {
|
||||||
},
|
},
|
||||||
permissions?: string[],
|
permissions?: string[],
|
||||||
extraHTTPHeaders?: NameValue[],
|
extraHTTPHeaders?: NameValue[],
|
||||||
fetchFailOnStatusCode?: boolean,
|
apiRequestFailsOnErrorStatus?: boolean,
|
||||||
offline?: boolean,
|
offline?: boolean,
|
||||||
httpCredentials?: {
|
httpCredentials?: {
|
||||||
username: string,
|
username: string,
|
||||||
|
|
@ -1191,7 +1191,7 @@ export type BrowserNewContextParams = {
|
||||||
},
|
},
|
||||||
permissions?: string[],
|
permissions?: string[],
|
||||||
extraHTTPHeaders?: NameValue[],
|
extraHTTPHeaders?: NameValue[],
|
||||||
fetchFailOnStatusCode?: boolean,
|
apiRequestFailsOnErrorStatus?: boolean,
|
||||||
offline?: boolean,
|
offline?: boolean,
|
||||||
httpCredentials?: {
|
httpCredentials?: {
|
||||||
username: string,
|
username: string,
|
||||||
|
|
@ -1258,7 +1258,7 @@ export type BrowserNewContextOptions = {
|
||||||
},
|
},
|
||||||
permissions?: string[],
|
permissions?: string[],
|
||||||
extraHTTPHeaders?: NameValue[],
|
extraHTTPHeaders?: NameValue[],
|
||||||
fetchFailOnStatusCode?: boolean,
|
apiRequestFailsOnErrorStatus?: boolean,
|
||||||
offline?: boolean,
|
offline?: boolean,
|
||||||
httpCredentials?: {
|
httpCredentials?: {
|
||||||
username: string,
|
username: string,
|
||||||
|
|
@ -1328,7 +1328,7 @@ export type BrowserNewContextForReuseParams = {
|
||||||
},
|
},
|
||||||
permissions?: string[],
|
permissions?: string[],
|
||||||
extraHTTPHeaders?: NameValue[],
|
extraHTTPHeaders?: NameValue[],
|
||||||
fetchFailOnStatusCode?: boolean,
|
apiRequestFailsOnErrorStatus?: boolean,
|
||||||
offline?: boolean,
|
offline?: boolean,
|
||||||
httpCredentials?: {
|
httpCredentials?: {
|
||||||
username: string,
|
username: string,
|
||||||
|
|
@ -1395,7 +1395,7 @@ export type BrowserNewContextForReuseOptions = {
|
||||||
},
|
},
|
||||||
permissions?: string[],
|
permissions?: string[],
|
||||||
extraHTTPHeaders?: NameValue[],
|
extraHTTPHeaders?: NameValue[],
|
||||||
fetchFailOnStatusCode?: boolean,
|
apiRequestFailsOnErrorStatus?: boolean,
|
||||||
offline?: boolean,
|
offline?: boolean,
|
||||||
httpCredentials?: {
|
httpCredentials?: {
|
||||||
username: string,
|
username: string,
|
||||||
|
|
@ -4745,7 +4745,7 @@ export type AndroidDeviceLaunchBrowserParams = {
|
||||||
},
|
},
|
||||||
permissions?: string[],
|
permissions?: string[],
|
||||||
extraHTTPHeaders?: NameValue[],
|
extraHTTPHeaders?: NameValue[],
|
||||||
fetchFailOnStatusCode?: boolean,
|
apiRequestFailsOnErrorStatus?: boolean,
|
||||||
offline?: boolean,
|
offline?: boolean,
|
||||||
httpCredentials?: {
|
httpCredentials?: {
|
||||||
username: string,
|
username: string,
|
||||||
|
|
@ -4810,7 +4810,7 @@ export type AndroidDeviceLaunchBrowserOptions = {
|
||||||
},
|
},
|
||||||
permissions?: string[],
|
permissions?: string[],
|
||||||
extraHTTPHeaders?: NameValue[],
|
extraHTTPHeaders?: NameValue[],
|
||||||
fetchFailOnStatusCode?: boolean,
|
apiRequestFailsOnErrorStatus?: boolean,
|
||||||
offline?: boolean,
|
offline?: boolean,
|
||||||
httpCredentials?: {
|
httpCredentials?: {
|
||||||
username: string,
|
username: string,
|
||||||
|
|
|
||||||
|
|
@ -468,7 +468,7 @@ ContextOptions:
|
||||||
extraHTTPHeaders:
|
extraHTTPHeaders:
|
||||||
type: array?
|
type: array?
|
||||||
items: NameValue
|
items: NameValue
|
||||||
fetchFailOnStatusCode: boolean?
|
apiRequestFailsOnErrorStatus: boolean?
|
||||||
offline: boolean?
|
offline: boolean?
|
||||||
httpCredentials:
|
httpCredentials:
|
||||||
type: object?
|
type: object?
|
||||||
|
|
@ -694,7 +694,7 @@ Playwright:
|
||||||
extraHTTPHeaders:
|
extraHTTPHeaders:
|
||||||
type: array?
|
type: array?
|
||||||
items: NameValue
|
items: NameValue
|
||||||
fetchFailOnStatusCode: boolean?
|
apiRequestFailsOnErrorStatus: boolean?
|
||||||
clientCertificates:
|
clientCertificates:
|
||||||
type: array?
|
type: array?
|
||||||
items:
|
items:
|
||||||
|
|
|
||||||
|
|
@ -16,9 +16,9 @@
|
||||||
|
|
||||||
import { browserTest as it, expect } from '../config/browserTest';
|
import { browserTest as it, expect } from '../config/browserTest';
|
||||||
|
|
||||||
it('should throw when fetchFailOnStatusCode is set to true inside BrowserContext options', async ({ browser, server }) => {
|
it('should throw when apiRequestFailsOnErrorStatus is set to true inside BrowserContext options', async ({ browser, server }) => {
|
||||||
it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/34204' });
|
it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/34204' });
|
||||||
const context = await browser.newContext({ fetchFailOnStatusCode: true });
|
const context = await browser.newContext({ apiRequestFailsOnErrorStatus: true });
|
||||||
server.setRoute('/empty.html', (req, res) => {
|
server.setRoute('/empty.html', (req, res) => {
|
||||||
res.writeHead(404, { 'Content-Length': 10, 'Content-Type': 'text/plain' });
|
res.writeHead(404, { 'Content-Length': 10, 'Content-Type': 'text/plain' });
|
||||||
res.end('Not found.');
|
res.end('Not found.');
|
||||||
|
|
@ -30,7 +30,7 @@ it('should throw when fetchFailOnStatusCode is set to true inside BrowserContext
|
||||||
|
|
||||||
it('should not throw when failOnStatusCode is set to false inside BrowserContext options', async ({ browser, server }) => {
|
it('should not throw when failOnStatusCode is set to false inside BrowserContext options', async ({ browser, server }) => {
|
||||||
it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/34204' });
|
it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/34204' });
|
||||||
const context = await browser.newContext({ fetchFailOnStatusCode: false });
|
const context = await browser.newContext({ apiRequestFailsOnErrorStatus: false });
|
||||||
server.setRoute('/empty.html', (req, res) => {
|
server.setRoute('/empty.html', (req, res) => {
|
||||||
res.writeHead(404, { 'Content-Length': 10, 'Content-Type': 'text/plain' });
|
res.writeHead(404, { 'Content-Length': 10, 'Content-Type': 'text/plain' });
|
||||||
res.end('Not found.');
|
res.end('Not found.');
|
||||||
|
|
@ -40,10 +40,10 @@ it('should not throw when failOnStatusCode is set to false inside BrowserContext
|
||||||
await context.close();
|
await context.close();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should throw when fetchFailOnStatusCode is set to true inside browserType.launchPersistentContext options', async ({ browserType, server, createUserDataDir }) => {
|
it('should throw when apiRequestFailsOnErrorStatus is set to true inside browserType.launchPersistentContext options', async ({ browserType, server, createUserDataDir }) => {
|
||||||
it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/34204' });
|
it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/34204' });
|
||||||
const userDataDir = await createUserDataDir();
|
const userDataDir = await createUserDataDir();
|
||||||
const context = await browserType.launchPersistentContext(userDataDir, { fetchFailOnStatusCode: true });
|
const context = await browserType.launchPersistentContext(userDataDir, { apiRequestFailsOnErrorStatus: true });
|
||||||
server.setRoute('/empty.html', (req, res) => {
|
server.setRoute('/empty.html', (req, res) => {
|
||||||
res.writeHead(404, { 'Content-Length': 10, 'Content-Type': 'text/plain' });
|
res.writeHead(404, { 'Content-Length': 10, 'Content-Type': 'text/plain' });
|
||||||
res.end('Not found.');
|
res.end('Not found.');
|
||||||
|
|
@ -53,10 +53,10 @@ it('should throw when fetchFailOnStatusCode is set to true inside browserType.la
|
||||||
await context.close();
|
await context.close();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not throw when fetchFailOnStatusCode is set to false inside browserType.launchPersistentContext options', async ({ browserType, server, createUserDataDir }) => {
|
it('should not throw when apiRequestFailsOnErrorStatus is set to false inside browserType.launchPersistentContext options', async ({ browserType, server, createUserDataDir }) => {
|
||||||
it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/34204' });
|
it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/34204' });
|
||||||
const userDataDir = await createUserDataDir();
|
const userDataDir = await createUserDataDir();
|
||||||
const context = await browserType.launchPersistentContext(userDataDir, { fetchFailOnStatusCode: false });
|
const context = await browserType.launchPersistentContext(userDataDir, { apiRequestFailsOnErrorStatus: false });
|
||||||
server.setRoute('/empty.html', (req, res) => {
|
server.setRoute('/empty.html', (req, res) => {
|
||||||
res.writeHead(404, { 'Content-Length': 10, 'Content-Type': 'text/plain' });
|
res.writeHead(404, { 'Content-Length': 10, 'Content-Type': 'text/plain' });
|
||||||
res.end('Not found.');
|
res.end('Not found.');
|
||||||
|
|
|
||||||
|
|
@ -537,9 +537,9 @@ it('should retry ECONNRESET', {
|
||||||
await request.dispose();
|
await request.dispose();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should throw when fetchFailOnStatusCode is set to true inside APIRequest context options', async ({ playwright, server }) => {
|
it('should throw when apiRequestFailsOnErrorStatus is set to true inside APIRequest context options', async ({ playwright, server }) => {
|
||||||
it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/34204' });
|
it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/34204' });
|
||||||
const request = await playwright.request.newContext({ fetchFailOnStatusCode: true });
|
const request = await playwright.request.newContext({ apiRequestFailsOnErrorStatus: true });
|
||||||
server.setRoute('/empty.html', (req, res) => {
|
server.setRoute('/empty.html', (req, res) => {
|
||||||
res.writeHead(404, { 'Content-Length': 10, 'Content-Type': 'text/plain' });
|
res.writeHead(404, { 'Content-Length': 10, 'Content-Type': 'text/plain' });
|
||||||
res.end('Not found.');
|
res.end('Not found.');
|
||||||
|
|
@ -549,9 +549,9 @@ it('should throw when fetchFailOnStatusCode is set to true inside APIRequest con
|
||||||
await request.dispose();
|
await request.dispose();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not throw when fetchFailOnStatusCode is set to false inside APIRequest context options', async ({ playwright, server }) => {
|
it('should not throw when apiRequestFailsOnErrorStatus is set to false inside APIRequest context options', async ({ playwright, server }) => {
|
||||||
it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/34204' });
|
it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/34204' });
|
||||||
const request = await playwright.request.newContext({ fetchFailOnStatusCode: false });
|
const request = await playwright.request.newContext({ apiRequestFailsOnErrorStatus: false });
|
||||||
server.setRoute('/empty.html', (req, res) => {
|
server.setRoute('/empty.html', (req, res) => {
|
||||||
res.writeHead(404, { 'Content-Length': 10, 'Content-Type': 'text/plain' });
|
res.writeHead(404, { 'Content-Length': 10, 'Content-Type': 'text/plain' });
|
||||||
res.end('Not found.');
|
res.end('Not found.');
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue