Open Ouadie opened 8 years ago
I added Restangular.setFullResponse(true); and I can't get all the headers from the response.
Restangular.setFullResponse(true);
Here is my config:
angular.module('MyWebsite') .factory('MyWebsiteApiRestangular', function (Restangular, transformersFactory, store) { return Restangular.withConfig(function(RestangularConfigurer) { RestangularConfigurer.setBaseUrl('http://127.0.0.1/MyWebsite'); RestangularConfigurer.setDefaultHeaders({Authorization: 'Bearer ' + store.get('token')}); RestangularConfigurer.setFullResponse(true); RestangularConfigurer.addResponseInterceptor(function(data, operation, what, url, response, deferred) { var token = response.headers("authorization"); // ... }); // ...
And here is the response of my web server: OPTIONS http://127.0.0.1/MyWebsite/item/1
access-control-allow-methods: GET, POST, PUT, DELETE access-control-allow-headers: ACCEPT, AUTHORIZATION access-control-allow-origin: http://127.0.0.1/MyWebsite
GET http://127.0.0.1/MyWebsite/item/1
Authorization: Bearer ThisIsMyToken Access-Control-Allow-Origin: http://localhost:9000
I have the same problem, is it a restangular issue?
Same here, although I'm getting response.headers is not a function. Response.headers returns undefined.
I added
Restangular.setFullResponse(true);
and I can't get all the headers from the response.Here is my config:
And here is the response of my web server: OPTIONS http://127.0.0.1/MyWebsite/item/1
GET http://127.0.0.1/MyWebsite/item/1