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
Static replies in Intercept drop falsy values #15234
Comments
5 tasks
The code for this is done in cypress-io/cypress#15235, but has yet to be released. |
Released in This comment thread has been locked. If you are still experiencing this issue after upgrading to |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Current behavior
Currently, if a falsy, but not
undefined
, value is passed as a static response such asreq.reply({ body: false })
, the boolean value is dropped by the net-stubbing backend. This behavior does not match up with the behavior fortrue
, wherereq.reply({ body: true })
will returntrue
.Desired behavior
At the very least, there should be consistency in how net-stubbing handles boolean values. I see two reasonable options:
I think the first option is the preferable one, and while the type definition for static responses only includes strings and JSON objects, I expect others might also be implicitly relying on
req.reply
to handle other types likeboolean
s ornumbers
.I have a branch that adds a couple
undefined
checks in place of truthychecks
that would match fix #1.Test code to reproduce
This is a test case that describes the current behavior.
Versions
Cypress 6.x
The text was updated successfully, but these errors were encountered: