Skip to content

commented HTML code prevents packages/proxy/lib/http/util/rewriter.ts from working properly #33000

@alexsch01

Description

@alexsch01

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions