Skip to content

Commit 998251b

Browse files
authored
test: add new test case. (#49)
1 parent 888ac87 commit 998251b

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

t/parameter.t

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,3 +200,38 @@ GET /t
200200
--- response_body
201201
match meta: metadata /asf
202202
matched: {"_path":"\/bb\/cc\/*",":ext":"xx","_method":"GET","_host":"*.bar.com"}
203+
204+
205+
206+
=== TEST 7: /name/*name/foo
207+
--- config
208+
location /t {
209+
content_by_lua_block {
210+
local json = require("cjson.safe")
211+
local radix = require("resty.radixtree")
212+
local rx = radix.new({
213+
{
214+
paths = {"/name/*name/foo"},
215+
metadata = "metadata /name",
216+
},
217+
})
218+
219+
local opts = {matched = {}}
220+
local meta = rx:match("/name/json/foo", opts)
221+
ngx.say("match meta: ", meta)
222+
ngx.say("matched: ", json.encode(opts.matched))
223+
224+
meta = rx:match("/name/json", opts)
225+
ngx.say("match meta: ", meta)
226+
ngx.say("matched: ", json.encode(opts.matched))
227+
}
228+
}
229+
--- request
230+
GET /t
231+
--- no_error_log
232+
[error]
233+
--- response_body
234+
match meta: metadata /name
235+
matched: {"_path":"\/name\/*name\/foo","name":"json"}
236+
match meta: nil
237+
matched: {}

0 commit comments

Comments
 (0)