如何解决GET 请求的 url 中作为 FormBody 参数的 json 数据始终为空
我的 api 中有一个 get 方法,它以 FormBody 作为参数。如果我从邮递员发送一个 JSON 数组,它就可以工作。但是如果我从我的 javascript 代码发送与 url 相同的数组,它在我的 GET 方法中显示为 null。这是我的 API GET 方法,
<Route(WebApiConfig.UrlPrefix & "/v1/entities/getbytasks")>
Public Async Function GetByTasks(<FromBody> inputModel As InputModel) As Threading.Tasks.Task(Of List(Of EntityModel))
// My code with return call
End Function
这里 inputModel 从我的 javascript 代码发送时始终为 nothing/null。这是我的 javascript 代码,
var childTaskIds = { taskIds: [233642,234315,123323] }; // I am sending this also from postman collection
var childTaskEntites = [];
$.when(
$.get('../api/v1/evententities/queries/getbytasks',+ childTaskIds.taskIds,function (returnChildData) {
childTaskEntites = returnChildData.Entities;
})
).then(function () {
if (childTaskEntites != null) {
return childTaskEntites;
}
});
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。