lensesio / cypress-websocket-testing

Test WebSocket connections with Cypress
Apache License 2.0
83 stars 11 forks source link

Can we pass "Authorization : Bearer token" in startUpMessage #25

Open Piyush12011990 opened 2 years ago

Piyush12011990 commented 2 years ago

Actually I have two issues

Please let me know if it is possible

dsebastian commented 2 years ago

Hi @Piyush12011990 . Unfortunately you can't as this in an issue with WS api in general. See here: https://stackoverflow.com/questions/4361173/http-headers-in-websockets-client-api#:~:text=You%20cannot%20add%20headers%20but,key1%3Dvalue1%26key2%3Dvalue2%22)%3B

For authentication it's recommended you use the startupmessage to send the payload and pick that up on the server.