mangoGoForward opened a new pull request #4819: URL: https://github.com/apache/apisix/pull/4819
### What this PR does / why we need it: <!--- Why is this change required? What problem does it solve? --> <!--- If it fixes an open issue, please link to the issue here. --> ### Pre-submission checklist: * [ ] Did you explain what problem does this PR solve? Or what new features have been added? * [x] Have you added corresponding test cases? * [x] Have you modified the corresponding document? * [ ] Is this PR backward compatible? **If it is not backward compatible, please discuss on the [mailing list](https://github.com/apache/apisix/tree/master#community) first** ## Summary - [**Name**](#name) - [**Attributes**](#Attributes) - [**How To Enable**](#how-to-enable) - [**Test Plugin**](#test-plugin) - [**Disable Plugin**](#disable-plugin) ## name xml-json-conversion plugin convert xml data from request body to json response, and vice versa ## Attributes None ## how-to-enable Here's an example, enable this plugin on the specified route: ```shell curl -i http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d ' { "uri": "/hello", "plugins": { "xml-json-conversion": {} }, "upstream": { "type": "roundrobin", "nodes": { "39.97.63.215:80": 1 } } }' ``` ## test-plugin Via curl to access ```shell curl -X GET http://127.0.0.1:9080/hello \ -H 'Content-Type: text/xml' \ -H 'Accept: application/json' \ --data ' <people> <person> <name>Manoel</name> <city>Palmas-TO</city> </person> </people>' {"people":{"person":{"name":"Manoel","city":"Palmas-TO"}}} ``` ## disable-plugin When you want to disable the `xml-json-conversion` plugin, it is very simple, you can delete the corresponding json configuration in the plugin configuration, no need to restart the service, it will take effect immediately: ```shell curl -i http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d ' { "uri": "/hello", "upstream": { "type": "roundrobin", "nodes": { "39.97.63.215:80": 1 } } }' ``` -- 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]
