在2.22.0和2.21.4基础库上,调用 callContainer 函数POST格式为JSON的数据时,服务器返回 415 错误。
此时,服务器上的日志显示:Resolved [org.springframework.web.HttpMediaTypeNotSupportedException: Content type 'application/x-www-form-urlencoded;charset=UTF-8' not supported]
这与文档中 content type 默认为 application/json 的描述不符。即便是在 header 中强行指定 content type,错误依然存在。
经测试,相同的代码在2.21.3及以前的版本中均可正常运行。
请复核该问题是否为 BUG , 或者该如何暂时解决该问题,谢谢!

你好,麻烦确认一下工具是否开启了独立域调试?工具 Network 面板能否提供下对应请求的截图呢?
不过,还有几个疑问:
1。此选项的作用是什么?
2。今后开发时,应在什么情况下启用该选项?
3。无脑启用该选项后,会有什么负面影响?
谢谢协助!
你的代码是否有修改 Regexp 原型链的情况?如果有做一些 hack,会影响基础库的行为表现,导致出现图中问题的,请避免进行类似修改。
const ContainerInfo = {config: { env: 'test-8gambnzh3b504aa6' },header: {'X-WX-SERVICE': 'rsp-core-service','content-type': 'application/json'},method: 'POST'}cloud.callContainer({...ContainerInfo,method: 'POST',path: '/share',data: {shareType: 'KOL',recruitId: recruit.id,kolId: kolEntity.id}})最近测试时间:2022-02-16 10:36:22
最新回包截图:
你好,麻烦提供下环境ID,问题发生时间点,相关代码,最新的回包。
cloud.callContainer({...CloudApi.ContainerInfo,method: 'POST',path: '/share',data: {shareType: 'KOL',recruitId: recruit.id,kolId: kolEntity.id}}).then((res: any) => {debug(res);const kolShareNode: ShareInfoType = res?.data?.share ?? {};if (kolShareNode.id) {setKolShareId(kolShareNode.id);} else {setKolShareId(undefined);}}).catch((err: any) => {error(err);setKolShareId(undefined);})export const ContainerInfo = {config: { env: 'test-8gambnzh3b504aa6' },header: {'X-WX-SERVICE': 'rsp-core-service','content-type': 'application/json'},method: 'POST'}