您好我面临角度http post方法的问题。如果我尝试使用angularjs http post发送数据,它会将数据作为查询字符串发送。因为我传递了非常大的数据,它给了我错误:服务器响应状态为414(Request-URI太长)。
这是我的http post工厂方法:
dataFactory.InsertInAdditionalDataDetailsIdBulk = function (AdditionalDataDetailsIds, AdditionalDataID,
AdditionalDataName, AdditionalDataDate) {
var params = {
AdditionalDataDetailsIds: AdditionalDataDetailsIds,
AdditionalDataID: AdditionalDataID,
AdditionalDataName: AdditionalDataName,
AdditionalDataDate: AdditionalDataDate
}
return $http({
url: '/GroupsManager/InsertInAdditionalDataDetailsIdBulk',
method: 'POST',
params: params
});
};
为什么我的数据即使在使用Post方法后也作为查询字符串参数发送?
答案 0 :(得分:11)
将params放入数据键..
return $http({
url: '/GroupsManager/InsertInAdditionalDataDetailsIdBulk',
method: 'POST',
data: params
});