简体   繁体   English

无法将 Content-Type 更改为“application/json;charset=UTF-8”

[英]Unable to Change Content-Type to "application/json; charset=UTF-8"

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.我正在使用 IBM API 与网关脚本连接将content type更改为"application/json; charset=UTF-8"但看起来默认情况下它在标头中提供"application/json" I am calling Google Translate API and needs to pass some special character.我正在调用 Google Translate API 并需要传递一些特殊字符。

What am I missing here?我在这里缺少什么?

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.在发送 JSON 响应之前,我在地图策略中使用了“application/json; charset=UTF-8”并且它起作用了。 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 :)这就是我让它工作的方式,但不确定我上面的陈述是否完全正确:)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Express:从 Content-Type "application/json; charset=utf-8" 中删除 charset=utf-8 - Express: Remove charset=utf-8 from Content-Type "application/json; charset=utf-8" 无法在Node js中使用“ content-type”:“ text / plain; charset = UTF-8” - Unable to Print a JSON Object in Node js with “content-type”: “text/plain; charset=UTF-8” encodeURIComponent 和 content-type: 'charset: utf-8' - encodeURIComponent and content-type: 'charset: utf-8' 可怕的错误:错误的内容类型 header,未知的内容类型:text/plain;charset=UTF-8 - formidable error: bad content-type header, unknown content-type: text/plain;charset=UTF-8 将Content-Type的响应标头设置为“ application / json; charset = utf-16”将json转换为中文字符 - Setting response header for Content-Type as “application/json; charset=utf-16” converts json to chinese character 如何将Content-Type:appication / x-www-form-urlencoded更改为application / json? - How to change Content-Type: appication/x-www-form-urlencoded to application/json? 如何使用提取以应用程序/ JSON的内容类型发布 - How to use fetch to post with content-type of application/json iOS和Node:将内容类型设置为application / json的正确方法 - iOS and Node: Correct way to set content-type to application/json Pocket身份验证返回内容类型为'application / json'的BadRequest - Pocket authentication returns BadRequest with content-type 'application/json' 使用 node.js 发送 Content-Type: application/json post - send Content-Type: application/json post with node.js
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM