Skip to content

Commit

Permalink
feat(fetch): maxRetries for fetch
Browse files Browse the repository at this point in the history
  • Loading branch information
YusukeIwaki committed Aug 22, 2024
1 parent 812ad6e commit 1f64e61
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/playwright/channel_owners/api_request_context.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ def fetch(
headers: nil,
ignoreHTTPSErrors: nil,
maxRedirects: nil,
maxRetries: nil,
method: nil,
multipart: nil,
params: nil,
Expand All @@ -73,6 +74,7 @@ def fetch(
headers: headers,
ignoreHTTPSErrors: ignoreHTTPSErrors,
maxRedirects: maxRedirects,
maxRetries: maxRetries,
method: method,
multipart: multipart,
params: params,
Expand All @@ -89,6 +91,7 @@ def fetch(
headers: nil,
ignoreHTTPSErrors: nil,
maxRedirects: nil,
maxRetries: nil,
method: nil,
multipart: nil,
params: nil,
Expand All @@ -102,6 +105,9 @@ def fetch(
if maxRedirects && maxRedirects < 0
raise ArgumentError.new("'maxRedirects' should be greater than or equal to '0'")
end
if maxRetries && maxRetries < 0
raise ArgumentError.new("'maxRetries' should be greater than or equal to '0'")
end

headers_obj = headers || request&.headers
fetch_params = {
Expand Down Expand Up @@ -153,6 +159,7 @@ def fetch(
fetch_params[:failOnStatusCode] = failOnStatusCode
fetch_params[:ignoreHTTPSErrors] = ignoreHTTPSErrors
fetch_params[:maxRedirects] = maxRedirects
fetch_params[:maxRetries] = maxRetries
fetch_params.compact!
response = @channel.send_message_to_server('fetch', fetch_params)

Expand Down

0 comments on commit 1f64e61

Please sign in to comment.