Skip to content

fix(network): prevent UnicodeDecodeError in Request.post_data for non-UTF8 bodies (fixes #3098) - #3159

Open
atiqur-rahman-pro wants to merge 1 commit into
microsoft:mainfrom
atiqur-rahman-pro:fix/request-post-data-unicode-3098
Open

fix(network): prevent UnicodeDecodeError in Request.post_data for non-UTF8 bodies (fixes #3098)#3159
atiqur-rahman-pro wants to merge 1 commit into
microsoft:mainfrom
atiqur-rahman-pro:fix/request-post-data-unicode-3098

Conversation

@atiqur-rahman-pro

Copy link
Copy Markdown

Summary of Changes

In playwright/_impl/_network.py, Request.post_data called .decode() without specifying error handling, which raises UnicodeDecodeError when request bodies contain non-UTF-8 payload bytes (e.g. binary data, Shift-JIS, or compressed bytes).

This PR updates .decode() calls to use errors="replace" to decode safely without raising exceptions.

Fixes #3098

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Request.post_data raises UnicodeDecodeError for non-UTF8 request bodies

1 participant