mirror of
https://gitea.invidious.io/iv-org/shard-kemal.git
synced 2024-08-15 00:53:36 +00:00
Update delegate macro in context
This commit is contained in:
parent
64fac62804
commit
8b6700695d
2 changed files with 1 additions and 24 deletions
|
@ -56,25 +56,4 @@ describe "Kemal::WebSocketHandler" do
|
||||||
response.headers["Sec-WebSocket-Accept"].should eq("s3pPLMBiTxaQ9kYGzzhZRbK+xOo=")
|
response.headers["Sec-WebSocket-Accept"].should eq("s3pPLMBiTxaQ9kYGzzhZRbK+xOo=")
|
||||||
response.upgrade_handler.should_not be_nil
|
response.upgrade_handler.should_not be_nil
|
||||||
end
|
end
|
||||||
|
|
||||||
it "has a sockets array" do
|
|
||||||
|
|
||||||
ws_handler = Kemal::WebSocketHandler.new "/" do |socket|
|
|
||||||
|
|
||||||
end
|
|
||||||
headers = HTTP::Headers{
|
|
||||||
"Upgrade": "websocket",
|
|
||||||
"Connection": "Upgrade",
|
|
||||||
"Sec-WebSocket-Key": "dGhlIHNhbXBsZSBub25jZQ==",
|
|
||||||
}
|
|
||||||
|
|
||||||
# Websocket request
|
|
||||||
request = HTTP::Request.new("GET", "/", headers)
|
|
||||||
response = ws_handler.call request
|
|
||||||
response.status_code.should eq(101)
|
|
||||||
response.headers["Upgrade"].should eq("websocket")
|
|
||||||
response.headers["Connection"].should eq("Upgrade")
|
|
||||||
response.headers["Sec-WebSocket-Accept"].should eq("s3pPLMBiTxaQ9kYGzzhZRbK+xOo=")
|
|
||||||
response.upgrade_handler.should_not be_nil
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -23,7 +23,5 @@ class Kemal::Context
|
||||||
end
|
end
|
||||||
|
|
||||||
delegate headers, @request
|
delegate headers, @request
|
||||||
delegate status_code, @response
|
delegate status_code, :"status_code=", :"content_type=", @response
|
||||||
delegate :"status_code=", @response
|
|
||||||
delegate :"content_type=", @response
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue