Reputation: 33
I'm currently building a web application using the sails.js framework (v0.10.5), with an angular.js (v1.3.13) front-end. On the app's "sign-up" view, I'm using the angular $http service to post the new user's email and password to the database, via a sails RESTful API action. Testing this process on Chrome, I got an unexpected behavior.
On the first try, Chrome indicates a "failed" status on the post request, even though the new user gets inserted correctly in the database (the server responds 200 in this case). After deleting the new entry from the DB and pressing the confirmation button again, Chrome recognises that the request worked this time around, indicating a status "200 OK" on this second request.
First request (failed):
Second request (200):
Some other questions I've seen here regarding failed requests on Chrome point to AdBlock as the source of the problem, but I'm running Chrome "stock", without any plugins or extensions.
Upvotes: 3
Views: 1390
Reputation: 591
Are you certain that the first request is responding with 200? The (failed) status in Chrome's inspector would indicate otherwise. It sounds like perhaps your API is encountering an error after it inserts the record into the database, thus the operation succeeds in creating a new row, but the API returns a 5xx response. What do you see in your Sails.js logs?
Upvotes: 3