File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -338,7 +338,7 @@ async def _inner_fetch(
338
338
form_data : Optional [List [NameValue ]] = None
339
339
multipart_data : Optional [List [FormField ]] = None
340
340
post_data_buffer : Optional [bytes ] = None
341
- if data :
341
+ if data is not None :
342
342
if isinstance (data , str ):
343
343
if is_json_content_type (serialized_headers ):
344
344
json_data = data if is_json_parsable (data ) else json .dumps (data )
Original file line number Diff line number Diff line change @@ -457,3 +457,14 @@ async def test_should_serialize_null_values_in_json(
457
457
assert response .status == 200
458
458
assert await response .text () == '{"foo": null}'
459
459
await request .dispose ()
460
+
461
+
462
+ async def test_should_serialize_empty_array_as_json (
463
+ playwright : Playwright , server : Server
464
+ ) -> None :
465
+ request = await playwright .request .new_context ()
466
+ server .set_route ("/echo" , lambda req : (req .write (req .post_body ), req .finish ()))
467
+ response = await request .post (server .PREFIX + "/echo" , data = [])
468
+ assert response .status == 200
469
+ assert await response .text () == "[]"
470
+ await request .dispose ()
You can’t perform that action at this time.
0 commit comments