dramenk opened a new issue, #10478: URL: https://github.com/apache/apisix/issues/10478
### Current Behavior When I use the fault-injection plugin as: ``` curl http://127.0.0.1:9180/apisix/admin/routes/1 \ -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d ' { "plugins": { "fault-injection": { "abort": { "http_status": 200, "body": "{\"count\": $arg_count}" } } }, "upstream": { "nodes": { "127.0.0.1:1980": 1 }, "type": "roundrobin" }, "uri": "/hello" }' ``` I get the response: ``` $ curl http://127.0.0.1:9080/hello\?count\=3 {"count": 3 ``` ### Expected Behavior It seems to be missing the right brace, although it's also to walk around by: `"body": "{\"count\": ${arg_count}}"` [Relevant code](https://github.com/apache/apisix/blob/release/3.6/apisix/core/utils.lua#L295) : ```lua local resolve_var do local _ctx local n_resolved local pat = [[(?<!\\)\$\{?(\w+)\}?]] ... ``` Can it be modified to like `[[(?<!\\)\$(\{(\w+)\}|(\w+))]]`? Otherwise, expressions like `${a `and `$a}` will both be extracted as variables, which seems a bit confusing. ### Error Logs _No response_ ### Steps to Reproduce 1. Run APISIX via the Docker image. 2. Using the above configuration and curl. ### Environment - APISIX version (run `apisix version`):3.6.0 - Operating system (run `uname -a`): NA - OpenResty / Nginx version (run `openresty -V` or `nginx -V`):openresty/1.21.4.2 - etcd version, if relevant (run `curl http://127.0.0.1:9090/v1/server_info`):NA - APISIX Dashboard version, if relevant: NA - Plugin runner version, for issues related to plugin runners: NA - LuaRocks version, for installation issues (run `luarocks --version`): NA -- 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]
