Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion playwright/_impl/_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ def post_data_json(self) -> Optional[Any]:
return None
content_type = self.headers.get("content-type")
if content_type and "application/x-www-form-urlencoded" in content_type:
return dict(parse.parse_qsl(post_data))
return dict(parse.parse_qsl(post_data, keep_blank_values=True))
try:
return json.loads(post_data)
except Exception:
Expand Down
4 changes: 2 additions & 2 deletions tests/async/test_page_network_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ async def test_should_parse_the_data_if_content_type_is_application_x_www_form_u
headers: {
'content-type': 'application/x-www-form-urlencoded; charset=UTF-8',
},
body: 'foo=bar&baz=123'
body: 'foo=bar&baz=123&empty='
})"""
)
request = await request_info.value
assert request
assert request.post_data_json == {"foo": "bar", "baz": "123"}
assert request.post_data_json == {"foo": "bar", "baz": "123", "empty": ""}


async def test_existing_response_should_return_response_after_it_is_received(
Expand Down
Loading