mangoGoForward opened a new pull request #5016: URL: https://github.com/apache/apisix/pull/5016
### What this PR does / why we need it: ## 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 | Name | Type | Requirement | Default | Valid | Description | |:--------------|:--------|:------------|:--------|:----------------------------|:-------------| | from | string | optional | xml | ["xml", "json"] | input type | | to | string | optional | json | ["xml", "json"] | output type | ## 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": { "from": "xml", "to": "json" } }, "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' \ --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 } } }' ``` ### Pre-submission checklist: * [ ] Did you explain what problem does this PR solve? Or what new features have been added? * [ ] Have you added corresponding test cases? * [ ] 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** -- 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]
