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

Support application/xhtml+xml content-type in cy.visit() command #15738

Closed
vodlogic opened this issue Apr 1, 2021 · 3 comments · Fixed by #15741
Closed

Support application/xhtml+xml content-type in cy.visit() command #15738

vodlogic opened this issue Apr 1, 2021 · 3 comments · Fixed by #15741
Labels
type: feature New feature that does not currently exist

Comments

@vodlogic
Copy link
Contributor

vodlogic commented Apr 1, 2021

What would you like?

The cy.visit() command only supports text/html response content-type or documents which can be parsed as HTML. We need the ability to support XHTML documents by allowing response content-type containing application/xhtml+xml.* and avoid the following error message.

cy.visit() failed trying to load:

http://localhost:5000/index.xhtml

The content-type of the response we received from your web server was:

  > application/xhtml+xml

This was considered a failure because responses must have content-type: 'text/html'

Why is this needed?

Our applications run on some devices that use XHTML, which is a stricter extension of HTML based on XML, which browsers can render in the same way as text/html documents.

The content type is allowed in the accept header, but does not seem to be allowed on the response content-type. The current code that checks if the response body looks like html seems to fail to detect it as XHTML documents often begin with XML declarations.

I have had success asserting on-screen elements of XHTML documents with Cypress by disabling the current error messages and will submit a PR allowing the application/xhtml+xml.* response content-type.

@jennifer-shehane
Copy link
Member

Related: #1551

@jennifer-shehane jennifer-shehane added the type: feature New feature that does not currently exist label Apr 1, 2021
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Apr 1, 2021

The code for this is done in cypress-io/cypress#15741, 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 Apr 5, 2021

Released in 7.0.0.

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

@cypress-bot cypress-bot bot locked as resolved and limited conversation to collaborators Apr 5, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: feature New feature that does not currently exist
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants