https://cypress.io logo
How to use websocket protocol
# i-need-help
m
I'm trying to connect to Kubernetes API, especially its exec functionality, and that requires procotol change from HTTP to websocket. Calling cy.reqest() as normally I'd do it can't handle protocol change and gives error 400 status . Do you have any idea how to manage, please? request:
Copy code
cy.request({
      method: "POST",
      url: url,
      failOnStatusCode: false,  
      headers: {
        authorization:
          "Bearer " + token,
      },
    }).then((resp) => {
      expect(resp.status).to.eq(200);
    });
response:
Copy code
{
  "kind": "Status",
  "apiVersion": "v1",
  "metadata": {},
  "status": "Failure",
  "message": "Upgrade request required",
  "reason": "BadRequest",
  "code": 400
}
2 Views