Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions apisix/admin/v3_adapter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,8 @@ local function filter(body, args, resource)
if args.label then
label_matched = false
if body.list[i].value.labels then
for k, _ in pairs(body.list[i].value.labels) do
if k == args.label then
for k, v in pairs(body.list[i].value.labels) do
if k == args.label or k .. ":" .. v == args.label then
label_matched = true
break
end
Expand Down
8 changes: 8 additions & 0 deletions t/admin/filter.t
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,14 @@ passed
res = json.decode(res)
assert(#res.list == 0)

-- match labels' key and value
code, body, res = t('/apisix/admin/routes/?label=env2:production',
ngx.HTTP_GET
)
res = json.decode(res)
assert(#res.list == 1)
assert(res.list[1].value.id == "2")

ngx.status = code
ngx.say(body)
}
Expand Down
Loading