Openresty lua modify xml response and send it as json

here what I’m trying to do : my website send a post request to my reverse-proxy server which send it to a tier API. Tier API response with an XML format. I would like to modify the response then send it back to wy website with an exploitable format (xml or json or whatever)

I’m using openresty and try to modify my request reponse in body_filter_by_lua_block, when I modify ngx.arg[1] I receive an error “ERR_EMPTY_RESPONSE”

How can I modify my body response and send it back to my website ?

Read more here: Source link