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
|
@ -23,7 +23,7 @@ describe "ParamParser" do
|
|||
|
||||
it "parses url params" do
|
||||
kemal = Kemal::RouteHandler::INSTANCE
|
||||
kemal.add_route "POST", "/hello/:hasan" do |env|
|
||||
kemal.add_http_route "POST", "/hello/:hasan" do |env|
|
||||
"hello #{env.params.url["hasan"]}"
|
||||
end
|
||||
request = HTTP::Request.new("POST", "/hello/cemal")
|
||||
|
@ -35,7 +35,7 @@ describe "ParamParser" do
|
|||
|
||||
it "decodes url params" do
|
||||
kemal = Kemal::RouteHandler::INSTANCE
|
||||
kemal.add_route "POST", "/hello/:email/:money/:spanish" do |env|
|
||||
kemal.add_http_route "POST", "/hello/:email/:money/:spanish" do |env|
|
||||
email = env.params.url["email"]
|
||||
money = env.params.url["money"]
|
||||
spanish = env.params.url["spanish"]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue