From 07b3d60efad2fbe23bb5383afe6efea0ed25d345 Mon Sep 17 00:00:00 2001 From: Yury Semikhatsky Date: Wed, 19 Jun 2024 15:23:12 -0700 Subject: [PATCH] Address comments --- docs/src/api/class-requestoptions.md | 10 ++++++++++ docs/src/api/params.md | 2 +- packages/playwright-core/src/server/fetch.ts | 2 +- packages/playwright-core/types/types.d.ts | 12 ++++++------ 4 files changed, 18 insertions(+), 8 deletions(-) diff --git a/docs/src/api/class-requestoptions.md b/docs/src/api/class-requestoptions.md index b6eeb8970a..2ad31f8dbb 100644 --- a/docs/src/api/class-requestoptions.md +++ b/docs/src/api/class-requestoptions.md @@ -126,6 +126,16 @@ Whether to ignore HTTPS errors when sending network requests. 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. +## method: RequestOptions.setMaxRetries +* since: v1.46 +- returns: <[RequestOptions]> + +### param: RequestOptions.setMaxRetries.maxRetries +* since: v1.46 +- `maxRetries` <[int]> + +Maximum number of times socket errors should be retried. Currently only `ECONNRESET` error is retried. An error will be thrown if the limit is exceeded. Defaults to `5`. Pass `0` to disable retries. + ## method: RequestOptions.setMethod * since: v1.18 - returns: <[RequestOptions]> diff --git a/docs/src/api/params.md b/docs/src/api/params.md index 4f6e495974..b95372e2cf 100644 --- a/docs/src/api/params.md +++ b/docs/src/api/params.md @@ -462,7 +462,7 @@ Defaults to `20`. Pass `0` to not follow redirects. * langs: js, python, csharp - `maxRetries` <[int]> -Maximum number of times socket errors should be retried. Currently only `ECONNRESET` error are retried. An error will be thrown if the limit is exceeded. Defaults to `5`. Pass `0` to disable retries. +Maximum number of times socket errors should be retried. Currently only `ECONNRESET` error is retried. An error will be thrown if the limit is exceeded. Defaults to `5`. Pass `0` to disable retries. ## evaluate-expression - `expression` <[string]> diff --git a/packages/playwright-core/src/server/fetch.ts b/packages/playwright-core/src/server/fetch.ts index 76054b33cc..7f65af8799 100644 --- a/packages/playwright-core/src/server/fetch.ts +++ b/packages/playwright-core/src/server/fetch.ts @@ -261,7 +261,7 @@ export abstract class APIRequestContext extends SdkObject { // Retry on connection reset only. if (e.code !== 'ECONNRESET') throw e; - progress.log(`Received ECONNRESET, will retry after ${backoff}ms.`); + progress.log(` Received ECONNRESET, will retry after ${backoff}ms.`); await new Promise(f => setTimeout(f, backoff)); backoff *= 2; } diff --git a/packages/playwright-core/types/types.d.ts b/packages/playwright-core/types/types.d.ts index 0cfacaddb0..a7057a8d84 100644 --- a/packages/playwright-core/types/types.d.ts +++ b/packages/playwright-core/types/types.d.ts @@ -15964,7 +15964,7 @@ export interface APIRequestContext { maxRedirects?: number; /** - * Maximum number of times socket errors should be retried. Currently only `ECONNRESET` error are retried. An error + * Maximum number of times socket errors should be retried. Currently only `ECONNRESET` error is retried. An error * will be thrown if the limit is exceeded. Defaults to `5`. Pass `0` to disable retries. */ maxRetries?: number; @@ -16070,7 +16070,7 @@ export interface APIRequestContext { maxRedirects?: number; /** - * Maximum number of times socket errors should be retried. Currently only `ECONNRESET` error are retried. An error + * Maximum number of times socket errors should be retried. Currently only `ECONNRESET` error is retried. An error * will be thrown if the limit is exceeded. Defaults to `5`. Pass `0` to disable retries. */ maxRetries?: number; @@ -16156,7 +16156,7 @@ export interface APIRequestContext { maxRedirects?: number; /** - * Maximum number of times socket errors should be retried. Currently only `ECONNRESET` error are retried. An error + * Maximum number of times socket errors should be retried. Currently only `ECONNRESET` error is retried. An error * will be thrown if the limit is exceeded. Defaults to `5`. Pass `0` to disable retries. */ maxRetries?: number; @@ -16242,7 +16242,7 @@ export interface APIRequestContext { maxRedirects?: number; /** - * Maximum number of times socket errors should be retried. Currently only `ECONNRESET` error are retried. An error + * Maximum number of times socket errors should be retried. Currently only `ECONNRESET` error is retried. An error * will be thrown if the limit is exceeded. Defaults to `5`. Pass `0` to disable retries. */ maxRetries?: number; @@ -16370,7 +16370,7 @@ export interface APIRequestContext { maxRedirects?: number; /** - * Maximum number of times socket errors should be retried. Currently only `ECONNRESET` error are retried. An error + * Maximum number of times socket errors should be retried. Currently only `ECONNRESET` error is retried. An error * will be thrown if the limit is exceeded. Defaults to `5`. Pass `0` to disable retries. */ maxRetries?: number; @@ -16456,7 +16456,7 @@ export interface APIRequestContext { maxRedirects?: number; /** - * Maximum number of times socket errors should be retried. Currently only `ECONNRESET` error are retried. An error + * Maximum number of times socket errors should be retried. Currently only `ECONNRESET` error is retried. An error * will be thrown if the limit is exceeded. Defaults to `5`. Pass `0` to disable retries. */ maxRetries?: number;