question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`cy.intercept` on file upload endpoints seems to be reading the file stream, which can result in server-side throwing error

See original GitHub issue

This is easy to work around, so don’t stress about it too much. Just wanted to report in case it helps.

Current behavior

If I cy.intercept('POST', /profile\/picture/i).as('upload') to watch an endpoint that consumes a file upload, my .net core 3 server errors with “System.IO.IOException: Unexpected end of Stream, the content may have already been read by another component.”

Desired behavior

Maybe cypress just needs to set the stream position back to 0?

Versions

  • Cypress@6.0.1
  • Chrome 87 (the one cypress opens)
  • Win10

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
emilongcommented, Jan 20, 2021

FWIW The issue I had here was fixed in 6.2.1 🎉

1reaction
JohnnyFuncommented, Dec 8, 2020

I ended up just using ui loading indicators to know when the network request is completed. So something like this:

cy.get('.loading-thing').should('exist')
uploadFile()
cy.get('.loading-thing').should('not.exist')
Read more comments on GitHub >

github_iconTop Results From Across the Web

intercept - Cypress Documentation
Verifying the request modification​​ cy. intercept() cannot be debugged using cy. request() ! Cypress only intercepts requests made by your front-end application.
Read more >
Cypress cy.intercept Problems - Gleb Bahmutov
The command cy.intercept can match requests using a substring, a minimatch, or a regular expression. By default, it intercepts requests matching ...
Read more >
Cypress Error making HTTP POST with File in request body
The error only occurs when the function is run by a Cypress test. Cypress uses Node.js, and judging by the error message above...
Read more >
Untitled
Moc is the meta object compiler which is a widely used tool with Qt and creates standard C++ files to provide syntactic sugar...
Read more >
Securing Web Transactions: TLS Server Certificate Management
certificates risk system outages and security breaches, which can result in revenue loss, ... Most private keys used on TLS servers are stored...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found