无法将Content-Type更改为"application/json; charset = UTF-8" [英] Unable to Change Content-Type to "application/json; charset=UTF-8"

查看:539
本文介绍了无法将Content-Type更改为"application/json; charset = UTF-8"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用带网关脚本的IBM API connect将content type更改为"application/json; charset=UTF-8",但是默认情况下它看起来像在标头中提供"application/json".我正在调用Google Translate API,并且需要传递一些特殊字符.

I am using IBM API connect with Gateway script to change content type to "application/json; charset=UTF-8" but looks like by default it gives "application/json" in header. I am calling Google Translate API and needs to pass some special character.

我在这里想念什么?

推荐答案

只需回答我自己的问题即可.在发送JSON响应之前,我已经在映射策略中使用了"application/json; charset = UTF-8",它可以正常工作.如果设置不正确,则网关脚本将无法更改内容类型.这就是我的工作方式,但不确定我的上述说法是否正确:)

Just answering to my own question. I have used "application/json; charset=UTF-8" in the map policy just before sending the JSON response and it worked. If it is not set properly then Gateway Script wont be able to change the content type. This is how I made it work but not sure if my above statement is exact right :)

这篇关于无法将Content-Type更改为"application/json; charset = UTF-8"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆