-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
content-length header is lost under Cypress. #16469
Comments
Hello. Did you manage to view this issue? |
At the same time test
Works successfully. Property |
Please tell me why in cypress |
I have a chunked blob response and the |
Hello @adi518, |
Here's an example, it goes in your Cypress test code: cy.intercept( 'GET', 'https://foobar.com/media.mp4', (req) => {
req.continue((res) => {
// monkey patch content-length, since cypress has a bug
// where it won't pass this property to the response.
const contentLength = 123456;
res.headers['Content-Length'] = String(contentLength);
});
}
).as('mediaRequest'); Notice you'll have to update it when you change your mock or things can/will break. I think it might be possible to make this seamless by reading your mock with |
Hi @jennifer-shehane, |
@dvkruchinin Maybe it's miraculously fixed in version 8. |
Unfortunately it is still reproduced.
Without Cypress:
|
I am seeing the same issue. Did anyone manage to work around this or read through the code to find the issue? |
@dennisoelkers I posted a workaround just a few posts above. |
Just ran into the same issue, not trivial to find at all. Thanks @dvkruchinin for having reported this and @adi518 for the workaround. Hoping of course for a fix :) |
Thanks for the workaround, adi518. A little hint for all non-network-pros (like me): Take care to spell the header name 'Content-Length' correctly (with C and L upper case). Writing it lower case (as all the debug tools suggest) will make the solution fail (at least in my case it was). |
Still seeing this in |
Modifying the response header workaround is not working in case of |
Any update on this one? Thanks! |
I am experiencing the same problem. Thanks for the workaround but it I hope it will fixed |
Still experiencing this in 12.3.0, and the req.on("after:response", (response) => {
response.headers["Content-Length"] = "...";
}); Is a maintainer able to provide any insight on this issue or some guidance as to how a new contributor might appproach fixing it? |
Bump, is any maintainer able to provide a very rough guide on where to start looking for this issue? I'm really motivated to solve it, happy to open a PR, just some place to start would help a lot. I'm looking and Cypress is big. |
I have this issue for the past 6 months. I just upgrades to 12.17.2 in hopes of a fix, but no luck. Neither of the work-arounds worked for me either. Definitely hoping for a fix! |
@jennifer-shehane: Is this ever going to get some attention? We are working around this bug for three years now and would like to get rid of that, as it is very subtle and irritating to anyone not aware of it. |
Current behavior
When using Cypress, no
content-length
header is returned.This error is not reproduced when using the functionality without Cypress.
Desired behavior
Content length is returned.
Test code to reproduce
run the test
actions_objects2/case_77_intelligent_scissors.js
For checking without Cypress:
Open Chrome
Go to http://localhost:8080
Login as
admin
password12qwaszx
And reproduce the actions from the test
Versions
Cypress version: 6.4.0, 7.3.0
Browser: Chome Version 90.0.4430.93 (Official Build) (64-bit)
OS: 20.04.1-Ubuntu
The text was updated successfully, but these errors were encountered: