Don't raise on WS route not found

This commit is contained in:
Sdogruyol 2017-08-20 20:10:38 +03:00
parent 2b604dfb30
commit 3fd3349383
3 changed files with 21 additions and 7 deletions

View file

@ -1,6 +1,19 @@
require "./spec_helper"
describe "Kemal::WebSocketHandler" do
it "doesn't match on wrong route" do
handler = Kemal::WebSocketHandler.new "/" { }
headers = HTTP::Headers{
"Upgrade" => "websocket",
"Connection" => "Upgrade",
"Sec-WebSocket-Key" => "dGhlIHNhbXBsZSBub25jZQ==",
}
request = HTTP::Request.new("GET", "/asd", headers)
io_with_context = create_request_and_return_io(handler, request)
client_response = HTTP::Client::Response.from_io(io_with_context, decompress: false)
client_response.status_code.should eq(404)
end
it "matches on given route" do
handler = Kemal::WebSocketHandler.new "/" { }
headers = HTTP::Headers{