NativeScript HTTP Request Promise + WebApi Error
up vote
0
down vote
favorite
Using NativeScript, I am getting an error calling my C# WebApi if I do so in the "then" callback function of another HTTP request:
request({
url: 'API_ONE_URL',
method: 'GET'
}).then((response: HttpResponse) => {
request({
url: 'API_TWO_URL',
method: 'GET'
}).then((response: HttpResponse) => {
// Do something
}, (e) => {
});
}, (e) => {
});
The error I get is "Collection was modified after the enumerator was instantiated." It does not matter what sort of API I call. I created the following API to test an "empty" controller:
using System.Net;
using System.Net.Http;
using System.Web.Http;
namespace MyProject.Controllers
{
public class EX_TestController : ApiController
{
public HttpResponseMessage Get()
{
return Request.CreateResponse(HttpStatusCode.OK, new { Success = true });
}
}
}
"API_ONE_URL" works fine. If I call "API_TWO_URL" outside of the request callback function , it works fine. But if I call "API_TWO" inside of the callback for "API_ONE", I get that error.
I am stumped, any insight would be awesome!
c# nativescript
add a comment |
up vote
0
down vote
favorite
Using NativeScript, I am getting an error calling my C# WebApi if I do so in the "then" callback function of another HTTP request:
request({
url: 'API_ONE_URL',
method: 'GET'
}).then((response: HttpResponse) => {
request({
url: 'API_TWO_URL',
method: 'GET'
}).then((response: HttpResponse) => {
// Do something
}, (e) => {
});
}, (e) => {
});
The error I get is "Collection was modified after the enumerator was instantiated." It does not matter what sort of API I call. I created the following API to test an "empty" controller:
using System.Net;
using System.Net.Http;
using System.Web.Http;
namespace MyProject.Controllers
{
public class EX_TestController : ApiController
{
public HttpResponseMessage Get()
{
return Request.CreateResponse(HttpStatusCode.OK, new { Success = true });
}
}
}
"API_ONE_URL" works fine. If I call "API_TWO_URL" outside of the request callback function , it works fine. But if I call "API_TWO" inside of the callback for "API_ONE", I get that error.
I am stumped, any insight would be awesome!
c# nativescript
Sounds to me that is from your API itself and nothing seems specific to {N} here.
– Manoj
Nov 11 at 10:18
May be did you try calling third party stubs, for instance jsonplaceholder.typicode.com
– Manoj
Nov 11 at 10:27
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
Using NativeScript, I am getting an error calling my C# WebApi if I do so in the "then" callback function of another HTTP request:
request({
url: 'API_ONE_URL',
method: 'GET'
}).then((response: HttpResponse) => {
request({
url: 'API_TWO_URL',
method: 'GET'
}).then((response: HttpResponse) => {
// Do something
}, (e) => {
});
}, (e) => {
});
The error I get is "Collection was modified after the enumerator was instantiated." It does not matter what sort of API I call. I created the following API to test an "empty" controller:
using System.Net;
using System.Net.Http;
using System.Web.Http;
namespace MyProject.Controllers
{
public class EX_TestController : ApiController
{
public HttpResponseMessage Get()
{
return Request.CreateResponse(HttpStatusCode.OK, new { Success = true });
}
}
}
"API_ONE_URL" works fine. If I call "API_TWO_URL" outside of the request callback function , it works fine. But if I call "API_TWO" inside of the callback for "API_ONE", I get that error.
I am stumped, any insight would be awesome!
c# nativescript
Using NativeScript, I am getting an error calling my C# WebApi if I do so in the "then" callback function of another HTTP request:
request({
url: 'API_ONE_URL',
method: 'GET'
}).then((response: HttpResponse) => {
request({
url: 'API_TWO_URL',
method: 'GET'
}).then((response: HttpResponse) => {
// Do something
}, (e) => {
});
}, (e) => {
});
The error I get is "Collection was modified after the enumerator was instantiated." It does not matter what sort of API I call. I created the following API to test an "empty" controller:
using System.Net;
using System.Net.Http;
using System.Web.Http;
namespace MyProject.Controllers
{
public class EX_TestController : ApiController
{
public HttpResponseMessage Get()
{
return Request.CreateResponse(HttpStatusCode.OK, new { Success = true });
}
}
}
"API_ONE_URL" works fine. If I call "API_TWO_URL" outside of the request callback function , it works fine. But if I call "API_TWO" inside of the callback for "API_ONE", I get that error.
I am stumped, any insight would be awesome!
c# nativescript
c# nativescript
asked Nov 10 at 21:41
smann
1
1
Sounds to me that is from your API itself and nothing seems specific to {N} here.
– Manoj
Nov 11 at 10:18
May be did you try calling third party stubs, for instance jsonplaceholder.typicode.com
– Manoj
Nov 11 at 10:27
add a comment |
Sounds to me that is from your API itself and nothing seems specific to {N} here.
– Manoj
Nov 11 at 10:18
May be did you try calling third party stubs, for instance jsonplaceholder.typicode.com
– Manoj
Nov 11 at 10:27
Sounds to me that is from your API itself and nothing seems specific to {N} here.
– Manoj
Nov 11 at 10:18
Sounds to me that is from your API itself and nothing seems specific to {N} here.
– Manoj
Nov 11 at 10:18
May be did you try calling third party stubs, for instance jsonplaceholder.typicode.com
– Manoj
Nov 11 at 10:27
May be did you try calling third party stubs, for instance jsonplaceholder.typicode.com
– Manoj
Nov 11 at 10:27
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53243691%2fnativescript-http-request-promise-webapi-error%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Sounds to me that is from your API itself and nothing seems specific to {N} here.
– Manoj
Nov 11 at 10:18
May be did you try calling third party stubs, for instance jsonplaceholder.typicode.com
– Manoj
Nov 11 at 10:27