mirror of
https://gitea.invidious.io/iv-org/shard-kemal.git
synced 2024-08-15 00:53:36 +00:00
Add context to WebSocket. This allows one to use context.params like url,query, body e.g
This commit is contained in:
parent
5a83522866
commit
2b604dfb30
9 changed files with 71 additions and 41 deletions
|
@ -9,7 +9,7 @@ describe "Kemal::FilterHandler" do
|
|||
filter_middleware._add_route_filter("GET", "/greetings", :before) { test_filter.modified = "true" }
|
||||
|
||||
kemal = Kemal::RouteHandler::INSTANCE
|
||||
kemal.add_route "GET", "/greetings" { test_filter.modified }
|
||||
kemal.add_http_route "GET", "/greetings" { test_filter.modified }
|
||||
|
||||
test_filter.modified.should eq("false")
|
||||
request = HTTP::Request.new("GET", "/greetings")
|
||||
|
@ -27,8 +27,8 @@ describe "Kemal::FilterHandler" do
|
|||
filter_middleware._add_route_filter("GET", "/greetings", :before) { test_filter.modified = test_filter.modified == "true" ? "false" : "true" }
|
||||
|
||||
kemal = Kemal::RouteHandler::INSTANCE
|
||||
kemal.add_route "GET", "/greetings" { test_filter.modified }
|
||||
kemal.add_route "POST", "/greetings" { test_filter.modified }
|
||||
kemal.add_http_route "GET", "/greetings" { test_filter.modified }
|
||||
kemal.add_http_route "POST", "/greetings" { test_filter.modified }
|
||||
|
||||
test_filter.modified.should eq("false")
|
||||
|
||||
|
@ -55,8 +55,8 @@ describe "Kemal::FilterHandler" do
|
|||
filter_middleware._add_route_filter("POST", "/greetings", :before) { test_filter.modified = test_filter.modified == "true" ? "false" : "true" }
|
||||
|
||||
kemal = Kemal::RouteHandler::INSTANCE
|
||||
kemal.add_route "GET", "/greetings" { test_filter.modified }
|
||||
kemal.add_route "POST", "/greetings" { test_filter.modified }
|
||||
kemal.add_http_route "GET", "/greetings" { test_filter.modified }
|
||||
kemal.add_http_route "POST", "/greetings" { test_filter.modified }
|
||||
|
||||
test_filter.modified.should eq("false")
|
||||
|
||||
|
@ -81,7 +81,7 @@ describe "Kemal::FilterHandler" do
|
|||
filter_middleware._add_route_filter("GET", "/greetings", :after) { test_filter.modified = "true" }
|
||||
|
||||
kemal = Kemal::RouteHandler::INSTANCE
|
||||
kemal.add_route "GET", "/greetings" { test_filter.modified }
|
||||
kemal.add_http_route "GET", "/greetings" { test_filter.modified }
|
||||
|
||||
test_filter.modified.should eq("false")
|
||||
request = HTTP::Request.new("GET", "/greetings")
|
||||
|
@ -99,8 +99,8 @@ describe "Kemal::FilterHandler" do
|
|||
filter_middleware._add_route_filter("GET", "/greetings", :after) { test_filter.modified = test_filter.modified == "true" ? "false" : "true" }
|
||||
|
||||
kemal = Kemal::RouteHandler::INSTANCE
|
||||
kemal.add_route "GET", "/greetings" { test_filter.modified }
|
||||
kemal.add_route "POST", "/greetings" { test_filter.modified }
|
||||
kemal.add_http_route "GET", "/greetings" { test_filter.modified }
|
||||
kemal.add_http_route "POST", "/greetings" { test_filter.modified }
|
||||
|
||||
test_filter.modified.should eq("false")
|
||||
|
||||
|
@ -127,8 +127,8 @@ describe "Kemal::FilterHandler" do
|
|||
filter_middleware._add_route_filter("POST", "/greetings", :after) { test_filter.modified = test_filter.modified == "true" ? "false" : "true" }
|
||||
|
||||
kemal = Kemal::RouteHandler::INSTANCE
|
||||
kemal.add_route "GET", "/greetings" { test_filter.modified }
|
||||
kemal.add_route "POST", "/greetings" { test_filter.modified }
|
||||
kemal.add_http_route "GET", "/greetings" { test_filter.modified }
|
||||
kemal.add_http_route "POST", "/greetings" { test_filter.modified }
|
||||
|
||||
test_filter.modified.should eq("false")
|
||||
request = HTTP::Request.new("GET", "/greetings")
|
||||
|
@ -158,9 +158,9 @@ describe "Kemal::FilterHandler" do
|
|||
filter_middleware._add_route_filter("ALL", "/greetings", :before) { test_filter_third.modified = test_filter_third.modified == "true" ? "false" : "true" }
|
||||
|
||||
kemal = Kemal::RouteHandler::INSTANCE
|
||||
kemal.add_route "GET", "/greetings" { test_filter.modified }
|
||||
kemal.add_route "POST", "/greetings" { test_filter_second.modified }
|
||||
kemal.add_route "PUT", "/greetings" { test_filter_third.modified }
|
||||
kemal.add_http_route "GET", "/greetings" { test_filter.modified }
|
||||
kemal.add_http_route "POST", "/greetings" { test_filter_second.modified }
|
||||
kemal.add_http_route "PUT", "/greetings" { test_filter_third.modified }
|
||||
|
||||
test_filter.modified.should eq("false")
|
||||
test_filter_second.modified.should eq("false")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue