don't prepend raw close code anymore

thanks to recent crystal changes adding support for close reasons we
don't need to encode things anymore.
This commit is contained in:
Luna 2021-05-12 12:17:02 -03:00
parent faeaeb4fba
commit bba5bef505

View file

@ -50,11 +50,9 @@ module Kemal
message = "Exception"
end
raw = uninitialized UInt8[2]
IO::ByteFormat::BigEndian.encode(code, raw.to_slice)
socket.not_nil!.close(
HTTP::WebSocket::CloseCode.new(code),
message: String.new(raw.to_slice) + message
message: message
)
raise error unless error.is_a?(WebsocketError)