Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: throw when serializing FilePayload in Form Fetch request #2671

Merged
merged 2 commits into from
Aug 17, 2023

Conversation

mxschmitt
Copy link
Member

@mxschmitt mxschmitt commented Aug 17, 2023

Fixes #2662

This might affect Java as well.

src/Playwright/Core/FormData.cs Outdated Show resolved Hide resolved
src/Playwright.Tests/BrowserContextFetchTests.cs Outdated Show resolved Hide resolved
{
var output = new List<object>();
foreach (var kvp in Values)
{
if (kvp.Value is FilePayload file)
{
if (throwWhenSerializingFilePayloads)
{
throw new PlaywrightException("Form requests don't support file payloads, use Multipart=formData instead.");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't it serialize just file name in case of url encoded params? In java we just send it as a json object which should make it clear on the receiving end that something was wrong with the encoding.

Copy link
Member Author

@mxschmitt mxschmitt Aug 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mxschmitt mxschmitt merged commit c6bcea1 into main Aug 17, 2023
14 of 16 checks passed
@mxschmitt mxschmitt deleted the fix-do-not-allow-serializing-files-in-form-requests branch August 17, 2023 19:40
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] Exception When Making A Request With A Multi-Part Form File
3 participants