mirror of
https://gitea.invidious.io/iv-org/shard-kemal.git
synced 2024-08-15 00:53:36 +00:00
17 lines
470 B
Crystal
17 lines
470 B
Crystal
|
require "./spec_helper"
|
||
|
|
||
|
describe "ParamParser" do
|
||
|
it "parses params" do
|
||
|
kemal = Kemal::Handler.new
|
||
|
kemal.add_route "POST", "/" do |env|
|
||
|
name = env.params["name"]
|
||
|
age = env.params["age"]
|
||
|
hasan = env.params["hasan"]
|
||
|
"Hello #{name} #{hasan} #{age}"
|
||
|
end
|
||
|
request = HTTP::Request.new("POST", "/?hasan=cemal", body: "name=kemal&age=99")
|
||
|
response = kemal.call(request)
|
||
|
response.body.should eq("Hello kemal cemal 99")
|
||
|
end
|
||
|
end
|