mirror of
https://gitea.invidious.io/iv-org/shard-kemal.git
synced 2024-08-15 00:53:36 +00:00
Improve websocket match logic. Fixes #401
This commit is contained in:
parent
e07be72dcf
commit
00981bcf44
2 changed files with 24 additions and 1 deletions
|
@ -47,4 +47,20 @@ describe "Kemal::WebSocketHandler" do
|
|||
io_with_context = create_ws_request_and_return_io(handler, request)
|
||||
io_with_context.to_s.should eq("HTTP/1.1 101 Switching Protocols\r\nUpgrade: websocket\r\nConnection: Upgrade\r\nSec-Websocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo=\r\n\r\n")
|
||||
end
|
||||
|
||||
it "matches correct verb" do
|
||||
handler = Kemal::WebSocketHandler::INSTANCE
|
||||
handler.next = Kemal::RouteHandler::INSTANCE
|
||||
ws "/" { }
|
||||
get "/" { "get" }
|
||||
request = HTTP::Request.new("GET", "/")
|
||||
io = IO::Memory.new
|
||||
response = HTTP::Server::Response.new(io)
|
||||
context = HTTP::Server::Context.new(request, response)
|
||||
handler.call(context)
|
||||
response.close
|
||||
io.rewind
|
||||
client_response = HTTP::Client::Response.from_io(io, decompress: false)
|
||||
client_response.body.should eq("get")
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue