Update delegate macro in context

This commit is contained in:
Sdogruyol 2015-12-27 11:17:22 +02:00
parent 64fac62804
commit 8b6700695d
2 changed files with 1 additions and 24 deletions

View file

@ -56,25 +56,4 @@ describe "Kemal::WebSocketHandler" do
response.headers["Sec-WebSocket-Accept"].should eq("s3pPLMBiTxaQ9kYGzzhZRbK+xOo=")
response.upgrade_handler.should_not be_nil
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

View file

@ -23,7 +23,5 @@ class Kemal::Context
end
delegate headers, @request
delegate status_code, @response
delegate :"status_code=", @response
delegate :"content_type=", @response
delegate status_code, :"status_code=", :"content_type=", @response
end