1
的内容类型的HTTP标头的HTTP POST字符串值是application/x-www-form-urlencoded
在身体
我必须发布一个字符串值。 environmentId: "predevnet"
我在去年的项目,我用jQuery来进行Ajax调用:
$.ajax({
headers: this.headers,
type: this.type,
url: this.url,
data: {environmentId: "predevnet"},
dataType: this.dataType,
contentType: this.contentType,
async: isAsync,
success: success,
cache: this.cache,
error: error
});
现在我试图做同样的呼叫角
return this.http
.post(this.baseUrl + action, JSON.stringify({environmentId: "predevnet"}), options)
.map(response => response.json() as DcResponse<T>);`
结果预计:表单数据应该是这样的:Result Expected
和我得到的结果和没有JSON.stringify
是这样的:Current results
请问,如果你设置它的工作内容类型头应用程序/ JSON? –
不,我试过了,但它发送了一个json对象..它只能发送名称为 –
的变量你试过使用'toString()'而不是'JSON.stringify()'吗? – Alex