request help: Advanced routing settings
Issue description
Environment
- apisix-version:2.0
- OS:centos 7
请问一下,高级路由配置的请求参数选项,其参数值是从body获取还是,路径获取,是否有解析body的插件呢

@aijunziaixifu You can read about var in here
@aijunziaixifu please use English in public channel
Hi, @aijunziaixifu, As the @spacewander answered in https://github.com/apache/apisix/issues/2763, you can write your filter function.
Here, I give you an example, you can have a try.
curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -i -d '{
"uri": "/index.html",
"methods": ["PUT", "GET"],
"upstream": {
"type": "roundrobin",
"nodes": {
"39.97.63.215:80": 1
}
},
"filter_func": "function(vars)
local core = require (\"apisix.core\")
local body, err = core.request.get_body()
if not body then
return false
end
local data, err = core.json.decode(body)
if not data then
return false
end
if data[\"a\"] == \"b\" then
return true
end
return false
end"
}'
By the way, I had seen many people have questions about this. May I add this to the document?
Hi, @aijunziaixifu, As the @spacewander answered in #2763, you can write your filter function.
Here, I give you an example, you can have a try.
curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -i -d '{ "uri": "/index.html", "methods": ["PUT", "GET"], "upstream": { "type": "roundrobin", "nodes": { "39.97.63.215:80": 1 } }, "filter_func": "function(vars) local core = require (\"apisix.core\") local body, err = core.request.get_body() if not body then return false end local data, err = core.json.decode(body) if not data then return false end if data[\"a\"] == \"b\" then return true end return false end" }'By the way, I had seen many people have questions about this. May I add this to the document?
That can be classified as one section of "Apache APISIX Best Practices".