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

cy.intercept fails to respond with JSON containing tilde (~) in string property #19178

Closed
LoaderB0T opened this issue Dec 1, 2021 · 4 comments · Fixed by #19239
Closed

cy.intercept fails to respond with JSON containing tilde (~) in string property #19178

LoaderB0T opened this issue Dec 1, 2021 · 4 comments · Fixed by #19239
Labels
topic: network type: bug type: regression A bug that didn't appear until a specific Cy version release v9.1.0 🐛 Issue present since 9.1

Comments

@LoaderB0T
Copy link

LoaderB0T commented Dec 1, 2021

Current behavior

When intercepting a request and responding with a JSON that contains a tilde an error is thrown.

cy.intercept("GET", "localhost/123", (res) => {
      res.reply({
        bla: "~",
      });
    });

VM263:1 Uncaught (in promise) SyntaxError: Unexpected token x in JSON at position 9

This seems to be a regression in 9.1.0, in 9.0.0 this executes just fine.

Desired behavior

No error, the response contains the correct object with a tilde.

Test code to reproduce

Repro repo: https://github.com/LoaderB0T/cypress-tilde-regression

Cypress Version

9.1.0

Other

No response

@LoaderB0T
Copy link
Author

Probably related to #19170

@LoaderB0T LoaderB0T changed the title cy.intercept fails to parse JSON with tilde (~) in json cy.intercept fails to respond with JSON with tilde (~) in string property Dec 1, 2021
@LoaderB0T LoaderB0T changed the title cy.intercept fails to respond with JSON with tilde (~) in string property cy.intercept fails to respond with JSON containing tilde (~) in string property Dec 1, 2021
@chrisbreiding chrisbreiding added topic: network type: bug type: regression A bug that didn't appear until a specific Cy version release v9.1.0 🐛 Issue present since 9.1 labels Dec 2, 2021
@cypress-bot cypress-bot bot added the stage: needs review The PR code is done & tested, needs review label Dec 3, 2021
@cypress-bot cypress-bot bot added stage: pending release and removed stage: needs review The PR code is done & tested, needs review labels Dec 3, 2021
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Dec 3, 2021

The code for this is done in cypress-io/cypress#19239, but has yet to be released.
We'll update this issue and reference the changelog when it's released.

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Dec 4, 2021

Released in 9.1.1.

This comment thread has been locked. If you are still experiencing this issue after upgrading to
Cypress v9.1.1, please open a new issue.

@cypress-bot cypress-bot bot locked as resolved and limited conversation to collaborators Dec 4, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
topic: network type: bug type: regression A bug that didn't appear until a specific Cy version release v9.1.0 🐛 Issue present since 9.1
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants