fix: we didn't traverse the plugin interceptors correctly (#2462)

This bug is introduced in 6a543a9.
This commit is contained in:
罗泽轩 2020-10-19 15:55:32 +08:00 committed by GitHub
parent 71dcf367d3
commit 5906c73a07
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -90,8 +90,8 @@ function fetch_api_router()
local code, body
local metadata = plugin_mod.plugin_metadata(name)
if metadata and metadata.interceptors then
for _, rule in ipairs(metadata.interceptors) do
if metadata and metadata.value.interceptors then
for _, rule in ipairs(metadata.value.interceptors) do
local f = interceptors[rule.name]
if f == nil then
core.log.error("unknown interceptor: ", rule.name)

View File

@ -309,7 +309,7 @@ passed
=== TEST 10: hit prometheus route
--- request
GET /apisix/prometheus/metrics
-- error_code: 403
--- error_code: 403
@ -350,7 +350,7 @@ passed
=== TEST 12: hit prometheus route again
--- request
GET /apisix/prometheus/metrics
-- error_code: 200
--- error_code: 200