mirror of
https://gitea.invidious.io/iv-org/shard-kemal.git
synced 2024-08-15 00:53:36 +00:00
Remove Context#app to reduce GC load (experimental)
This commit is contained in:
parent
72bcac6dd5
commit
5917af3f14
5 changed files with 8 additions and 15 deletions
|
@ -22,14 +22,14 @@ describe "ParamParser" do
|
|||
end
|
||||
|
||||
it "parses url params" do
|
||||
kemal = Kemal.application.route_handler
|
||||
kemal.add_route "POST", "/hello/:hasan" do |env|
|
||||
route_handler = Kemal.application.route_handler
|
||||
route_handler.add_route "POST", "/hello/:hasan" do |env|
|
||||
"hello #{env.params.url["hasan"]}"
|
||||
end
|
||||
request = HTTP::Request.new("POST", "/hello/cemal")
|
||||
# Radix tree MUST be run to parse url params.
|
||||
context = create_request_and_return_io_and_context(kemal, request)[1]
|
||||
url_params = Kemal::ParamParser.new(request, context.route_lookup.params).url
|
||||
io_with_context = create_request_and_return_io(route_handler, request)
|
||||
url_params = Kemal::ParamParser.new(request).url
|
||||
url_params["hasan"].should eq "cemal"
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue