summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/webdriver/tests/support/fixtures_bidi.py
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/webdriver/tests/support/fixtures_bidi.py')
-rw-r--r--testing/web-platform/tests/webdriver/tests/support/fixtures_bidi.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/testing/web-platform/tests/webdriver/tests/support/fixtures_bidi.py b/testing/web-platform/tests/webdriver/tests/support/fixtures_bidi.py
index 32919210bf..c76b369f21 100644
--- a/testing/web-platform/tests/webdriver/tests/support/fixtures_bidi.py
+++ b/testing/web-platform/tests/webdriver/tests/support/fixtures_bidi.py
@@ -538,7 +538,12 @@ def fetch(bidi_session, top_context, configuration):
"""
async def fetch(
- url, method="GET", headers=None, context=top_context, timeout_in_seconds=3
+ url,
+ method="GET",
+ headers=None,
+ post_data=None,
+ context=top_context,
+ timeout_in_seconds=3,
):
method_arg = f"method: '{method}',"
@@ -546,6 +551,10 @@ def fetch(bidi_session, top_context, configuration):
if headers is not None:
headers_arg = f"headers: {json.dumps(headers)},"
+ body_arg = ""
+ if post_data is not None:
+ body_arg = f"body: {post_data},"
+
timeout_in_seconds = timeout_in_seconds * configuration["timeout_multiplier"]
# Wait for fetch() to resolve a response and for response.text() to
# resolve as well to make sure the request/response is completed when
@@ -558,6 +567,7 @@ def fetch(bidi_session, top_context, configuration):
fetch("{url}", {{
{method_arg}
{headers_arg}
+ {body_arg}
signal: controller.signal,
}}).then(response => response.text());
}}""",