$http triggered twice

This is my code

$scope.login = function(email,password){
method: ‘POST’,
url: ‘http://localhost:3000/api/login’,
headers: {
‘owner’: $rootScope.secret
data: {email:email, password:password }
}).then(function successCallback(response) {
}, function errorCallback(response) {

But in my network tab I’m seeing 2 request, one is by ionic :slightly_smiling:

The second one is my POST request, I wonder why there’s one OPTION method up there.

The Option request method performs a preflight request to http://localhost:3000/api/login and includes the Origin and Access-Control-Request-Method headers with the appropriate values.
This is normal, don’t worry about it.

1 Like