tao12345666333 commented on code in PR #10112:
URL: https://github.com/apache/apisix/pull/10112#discussion_r1323814235
##########
apisix/core/utils.lua:
##########
@@ -375,5 +377,28 @@ end
-- Resolve {$1, $2, ...} in the given string
_M.resolve_var_with_captures = resolve_var_with_captures
+local function server_func(func_name, body, headers)
+ local local_conf = config_local.local_conf()
+
+ if local_conf.apisix and local_conf.apisix.server_func_addr
+ and local_conf.apisix.server_func_addr ~= "" then
+ local addr = local_conf.apisix.server_func_addr
+ if not string.has_suffix(addr, "/") then
+ addr = addr .. "/"
+ end
+ log.info("external server func to: " .. addr .. func_name ..
+ ", body: " .. json.encode(body))
+ local httpc = http.new()
+ local res, err = httpc:request_uri(addr .. func_name, {
+ method = "POST",
Review Comment:
Using parameters can indeed be more flexible.
https://github.com/apache/apisix/pull/10112#issuecomment-1716791638
As I mentioned before, a usage pattern is provided here. If users do not
want to use this pattern, they can implement the logic by themselves.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]