websocket_test.go 413 B

12345678910111213141516171819
  1. package websocket
  2. import (
  3. "testing"
  4. "github.com/stretchr/testify/assert"
  5. )
  6. const (
  7. // example in Sec-Websocket-Key in rfc6455
  8. testSecWebsocketKey = "dGhlIHNhbXBsZSBub25jZQ=="
  9. // example Sec-Websocket-Accept in rfc6455
  10. testSecWebsocketAccept = "s3pPLMBiTxaQ9kYGzzhZRbK+xOo="
  11. )
  12. func TestGenerateAcceptKey(t *testing.T) {
  13. assert.Equal(t, testSecWebsocketAccept, generateAcceptKey(testSecWebsocketKey))
  14. }