This question is locked. New answers and comments are not allowed.
Hello,
If you look at this work item http://aspnetwebstack.codeplex.com/workitem/177 in ASP.NET Web Api, you can see that there is an issue passing arrays to a Web API method, and the workaround is to pass the array with the data encased in an object with an anonymous property, eg :
$.ajax({
type:
'POST'
,
url: url,
data: {
''
: somearray}
}).done(
function
(data) {
//do something
}).fail({
//handle error
});
In NS, when I try to do this (using content parameter of HttpRequestOptions) to post to a web api that requires the body to be an array of objects, I end up getting null being passed every time. I can see that the content property is expecting a string, not an object and that seems to be causing the problem.
var
options: http.HttpRequestOptions = {
url: url,
method:
"POST"
,
content: {
""
: somearray }
};
http.request(options).then(
function
(response) {
//do something
},
function
(error) {
//handle error
});
Do you have any suggestions?
Thanks!