Error making HTTP POST with File object in request body after upgrading to 7.X #15908
Unanswered
donalmurtagh
asked this question in
Questions and Help
Replies: 2 comments
-
I'm pretty curious why this broke between 6.8.0 and 7.0.1. Do you have a minimal repo I could use to debug? Ideally the backend would also been in Node, for ease of running locally. |
Beta Was this translation helpful? Give feedback.
0 replies
-
I'm seeing the same err sometimes
@chromatic-com/cypress@^0.6.6 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I upgraded from Cypress 6.8.0 to 7.0.1. After the upgrade, when this function is called by one of the Cypress tests
I get the following error
The
http
object that I use to make the POST request is an Axios instance and thefile
object that I append to the request body is a File. The file object is the cause of the problem, because if I don't append it to the request body, the error doesn't occur.The error only occurs when the function is run by a Cypress test. Cypress uses Node.js, and judging by the error message above it seems the
File
type is not allowed. Furthermore, the Axios request config docs indicate that when Axios runs under Node, aFile
is not allowed.So I guess I need to convert the
File
objects to something else, so that this function will work both within the app itself, and when run by Cypress.On the server-side (a Spring Boot app), this file is bound to a
If my theory that the
File
type is the problem, what should I use instead and how should I do the conversion?Beta Was this translation helpful? Give feedback.
All reactions