diff --git a/playwright/_impl/_fetch.py b/playwright/_impl/_fetch.py index 6181f22b2..aa5d78a7f 100644 --- a/playwright/_impl/_fetch.py +++ b/playwright/_impl/_fetch.py @@ -394,7 +394,7 @@ async def _inner_fetch( post_data_buffer = data.encode() elif isinstance(data, bytes): post_data_buffer = data - elif isinstance(data, (dict, list, int, bool)): + elif isinstance(data, (dict, list, int, float, bool)): json_data = json.dumps(data) else: raise Error(f"Unsupported 'data' type: {type(data)}") diff --git a/tests/async/test_fetch_global.py b/tests/async/test_fetch_global.py index 10f82583c..c6b33e577 100644 --- a/tests/async/test_fetch_global.py +++ b/tests/async/test_fetch_global.py @@ -467,6 +467,7 @@ async def test_should_serialize_request_data( ([], "[]"), ({}, "{}"), ("", ""), + (1.5, "1.5"), ]: response = await request.post(server.PREFIX + "/echo", data=data) assert response.status == 200