shenyu
shenyu copied to clipboard
[BUG] I want to modify the content-type of returning data, but the modified Content-Type cannot take effect
Is there an existing issue for this?
- [X] I have searched the existing issues
Current Behavior
in this case, HTTP return json data, I want to change to the return format of XML, but the Content-Type cannot be modified.
Expected Behavior
i can change the response header in exchange,
exchange.getResponse().getHeaders().setContentType(xxx)
Steps To Reproduce
modify the body and header of response. return changed body but the content-type of response header un-changed
Environment
ShenYu version(s):
master
Debug logs
No response
Anything else?
what?
当我修改返回值的header头时,content-type字段无法修改,无论是我自定义的插件还是modifyResponse插件,都不成功。
我修改的方式是加入这段代码
exchange.getResponse().getHeaders().setContentType(xxx)
当我debug时,发现content-type有单独的方法去获取,可是并不是通过exchange的值获取。
我想问,正确修改response的content-type方式是什么?