spacewander commented on a change in pull request #3831:
URL: https://github.com/apache/apisix/pull/3831#discussion_r594262306
##########
File path: apisix/plugin.lua
##########
@@ -416,6 +416,10 @@ local function merge_service_route(service_conf,
route_conf)
new_conf.value.script = route_conf.value.script
end
+ if route_conf.value.name then
Review comment:
Can we use `new_conf.value.name = route_conf.value.name` directly?
##########
File path: t/core/ctx.t
##########
@@ -909,3 +909,109 @@ GET /hello
hello world
--- error_log eval
qr/request log: \{"route_id":"1"\}/
+
+
+
+=== TEST 34: add plugin metadata "route_name" and "service_name"
+--- config
+ location /t {
+ content_by_lua_block {
+ local t = require("lib.test_admin").test
+ local code, body = t('/apisix/admin/plugin_metadata/http-logger',
+ ngx.HTTP_PUT,
+ [[{
+ "log_format": {
+ "route_name": "$route_name",
+ "service_name": "$service_name"
+ }
+ }]],
+ [[{
+ "node": {
+ "value": {
+ "log_format": {
+ "route_name": "$route_name",
+ "service_name": "$service_name"
+ }
+ }
+ },
+ "action": "set"
+ }]]
+ )
+
+ ngx.status = code
+ ngx.say(body)
+ }
+ }
+--- request
+GET /t
+--- response_body
+passed
+--- no_error_log
+[error]
+
+
+
+=== TEST 35: add service and route, the service is bound to the route
+--- config
+ location /t {
+ content_by_lua_block {
+ local t = require("lib.test_admin").test
+ local code, body = t('/apisix/admin/services/1',
Review comment:
We can put TEST 35 into TEST 34.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]