Behavior
the html function of packages/proxy/lib/http/util/rewriter.ts is prone to injection failing in this case:
<html>
<!-- <head>
<title>Test</title>
</head> -->
</html>
it gets converted to this, which is not good
<html>
<!-- <head> <script type='text/javascript'> CYPRESS_INJECTION(); </script>
<title>Test</title>
</head> -->
<head> </head>
</html>
Test code to reproduce
it('', () => {
cy.intercept('/app', {
body: `
<html>
<!-- <head>
<title>Test</title>
</head> -->
</html>
`
})
cy.visit('/app')
})
Cypress Version
all versions (I tested in develop)
Other
Discovered this problem when working on #32982
@jennifer-shehane