It looks like you're setting request headers to get work with CORS but
these are headers that need to be set on the server as response headers.

Postman doesn't impose the same restrictions as the browser proper. It's an
app so it's loser on what it can do.

Do you control site at this URL, host_base_url + 'site/suggestCity'?

Adrian

On 23 October 2014 18:15, Andres Felipe Solarte López <[email protected]>
wrote:

> 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.
>

-- 
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.

Reply via email to