i have a REST client but when y try to do a request the GET method turns
into OPTIONS and Always i have 404 Unauthorized error, i tried the same
with Postman and everything worked well, here are the code :
rentingApp.factory("AutoCompleteService", ["$http", function ($http) {
return {
search: function (term) {
return $http({
method: "GET",
url: host_base_url + 'site/suggestCity',
headers: {
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Methods': 'GET, POST, PUT,
DELETE, OPTIONS',
'Access-Control-Allow-Headers': 'Content-Type,
X-Requested-With'
},
params: {
"term": term
},
});
}
};
}]);
and i have an HttpInterceptor , here is the code:
rentingApp.factory('myHttpInterceptor', function ($q) {
return {
'request': function (config) {
config.headers["Authorization"] = api_id;
return config || $q.when(config);
},
'requestError': function (rejection) {
return $q.reject(rejection);
},
'response': function (response) {
return response;
},
'responseError': function (rejection) {
return $q.reject(rejection);
}
};
}).config(function ($httpProvider) {
$httpProvider.interceptors.push('myHttpInterceptor');
});
for more details you can view the rest client
in http://as-webs.com/rest_rentingcarz/#/
Thank you all
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.