
[英]OWIN ApiController access to the request body/stringified JSON
[英]request body is stringified incorrectly when doing POST from angular microfronted put in JSP
所以,我有这个 angular 应用程序充当微前端,放在 JSP 中。 当我直接访问 angular 应用程序时 - 在它托管的网站上 - 一切都按预期工作。 当我尝试在 JSP 上使用它时会出现问题。 POST 数据的构建方式取决于用户使用应用程序的位置
当我直接进入应用程序时,POST body 构造正确
the data
{
yada: 123,
foo: 'bar',
array: [1, 2, 3]
}
request body
{
"yada": 123,
"foo": 'bar',
"array": [1, 2, 3]
}
但是当我通过 JSP 访问应用程序时,一切都变得很糟糕——有效载荷是
{
"yada": 123,
"foo": 'bar',
"array": "[\"1\", \"2\", \"3\"]
}
可以看到,数组是用引号括起来的,里面的每一个引号都被转义了,当然后端不能正常消费数据了。 负载中的所有数组都会发生这种情况
好像有效载荷被字符串化了两次? 还是与页面编码有关的问题?
角度服务中的 http 调用:
postData(data) {
return this.http.post(url, data)
// content type is set in nginx, which proxies the request further
不幸的是,我无法访问 JSP 页面源代码,因为它在另一个 IT 部门
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.