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: can send FormData with File. #16576

Merged
merged 3 commits into from
May 24, 2021
Merged

Conversation

sainthkh
Copy link
Contributor

User facing changelog

As socket.io ignores FormData body, Cypress driver couldn't send FormData with file. This PR fixes this behavior.

Additional details

  • Why was this change necessary? => Sending files is a valid behavior, but cy.request() doesn't support it.
  • What is affected by this change? => N/A
  • Any implementation details to explain? => This PR encodes FormData to base64 string to bypass socker.io.

How has the user experience changed?

N/A

PR Tasks

  • Have tests been added/updated?

@cypress-bot
Copy link
Contributor

cypress-bot bot commented May 19, 2021

Thanks for taking the time to open a PR!

@sainthkh sainthkh marked this pull request as ready for review May 19, 2021 02:02
@sainthkh sainthkh requested a review from a team as a code owner May 19, 2021 02:02
@sainthkh sainthkh requested review from chrisbreiding and kuceb and removed request for a team May 19, 2021 02:02
@sainthkh
Copy link
Contributor Author

Flaky failures I guess.

Copy link
Contributor

@chrisbreiding chrisbreiding left a comment

Choose a reason for hiding this comment

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

I think the 2 tests currently failing are legitimate. Looks like something is causing socket-io's hasBinary to infinitely recurse.

packages/driver/cypress/plugins/server.js Outdated Show resolved Hide resolved
packages/driver/src/cy/commands/request.js Outdated Show resolved Hide resolved
@sainthkh
Copy link
Contributor Author

sainthkh commented May 24, 2021

@chrisbreiding I failed to reproduce the hasBinary flakiness. And I also found that it exists in the develop branch (check #16640). It is maybe introduced from my previous PR, #15931. It's caused by circular object/array sent through socket.io. I'm trying to research when a circular object is passed to the server and why.

@chrisbreiding
Copy link
Contributor

I saw the hasBinary failures a couple times in a row, so I thought it was consistent, but you're right that it's flakiness. I appreciate you looking into the cause of it.

@chrisbreiding chrisbreiding marked this pull request as ready for review May 24, 2021 14:06
@chrisbreiding chrisbreiding self-requested a review May 24, 2021 14:06
@chrisbreiding chrisbreiding merged commit c258879 into cypress-io:develop May 24, 2021
pashidlos pushed a commit to pashidlos/cypress that referenced this pull request May 24, 2021
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.

Posting formData using cypress doesn't work
2 participants