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.
The text was updated successfully, but these errors were encountered:
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.
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 containingapplication/xhtml+xml.*
and avoid the following error message.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.The text was updated successfully, but these errors were encountered: