You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2021/07/08 00:58:12 UTC
[GitHub] [apisix] spacewander commented on a change in pull request #4558: fix: has_route_not_under_apisix value is wrongly assigned
spacewander commented on a change in pull request #4558:
URL: https://github.com/apache/apisix/pull/4558#discussion_r665796956
##########
File path: apisix/api_router.lua
##########
@@ -89,13 +89,20 @@ function fetch_api_router()
core.log.debug("fetched api routes: ",
core.json.delay_encode(api_routes, true))
for _, route in ipairs(api_routes) do
+ if has_route_not_under_apisix then
Review comment:
We can move this to the end of for loop?
##########
File path: apisix/api_router.lua
##########
@@ -89,13 +89,20 @@ function fetch_api_router()
core.log.debug("fetched api routes: ",
core.json.delay_encode(api_routes, true))
for _, route in ipairs(api_routes) do
+ if has_route_not_under_apisix then
+ break
+ end
local typ_uri = type(route.uri)
if typ_uri == "string" then
- has_route_not_under_apisix =
- not core.string.has_prefix(route.uri, "/apisix/")
+ if not core.string.has_prefix(route.uri, "/apisix/") then
+ has_route_not_under_apisix = true
+ end
else
for _, uri in ipairs(route.uri) do
- if not core.string.has_prefix(route.uri, "/apisix/") then
+ if has_route_not_under_apisix then
+ break
+ end
+ if not core.string.has_prefix(uri, "/apisix/") then
has_route_not_under_apisix = true
Review comment:
After that, we can break here directly?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org