Help! I don’t know what I’m doing wrong here !
I can’t get my response interceptor to see all the response headers
that should be available.
I don’t get it !!
I sure hope someone can point me in the right direction !!
Al;
—————>
I’m calling the server using a $resource
var BookletData = $resource(ENV.backend+'/booklet/:id', { id:
'@scriptRow.id' } );
—————>
I have the following response interceptor defined in my app.config()
$provide.factory('responseInterceptor', function() {
return {
response: function(resp) {
console.log('response.config.url',resp.config.url);
console.log('response.headers.AuthToken',resp.headers('AuthToken'));
console.log('response.headers',resp.headers());
return resp;
}
};
});
$httpProvider.interceptors.push('responseInterceptor');
—————>
And can I see it’s output in the console so I know it’s working:
app.js:67 response.config.url http://localhost:8000/api/booklet/11
app.js:68 response.headers.AuthToken null
app.js:69 response.headers Object {content-type: "application/json",
cache-control: "no-cache"}
angular.js:11699 booklet:11 was loaded
—————>
And yet the headers that were returned (based on the: Live HTTP Headers chrome
extension) were much more extensive and included the AuthToken that I am
looking for !!
GET
http://localhost:8000/api/booklet/11?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXUyJ9.eyJ1c2VybmFtZSI6ImFqb3NsaW4iLCJzdWIiOjUwLCJpc3MiOiJodHRwOlwvXC9sb2NhbGhvc3Q6ODAwMFwvYXBpXC9hdXRoXC9sb2dpbiIsImlhdCI6IjE0MzUwOTY4MTEiLCJleHAiOiIxNDM1MTAwNDExIiwibmJmIjoiMTQzNTA5NjgxMSIsImp0aSI6ImQ3YWJlM2NiMzY5MmQxN2JhMTBmNjVlODQ3MDMyMDA4In0.ZTYwYjJiMDA3ZDhkMjk0YWNkODdiMTg2ZmZiMDczYzgxMmJkZWVmOTBkYzhkN2E3YzA0YjhhMDE3YzVhYzNkYw
Status: HTTP/1.0 200 OK
Request Headers
Accept application/json, text/plain, */*
Accept-Encoding gzip, deflate, sdch
Accept-Language en-US,en;q=0.8,es;q=0.6
Origin http://localhost:9000
Referer http://localhost:9000/
User-Agent Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3)
AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2431.0 Safari/537.36
X-DevTools-Emulate-Network-Conditions-Client-Id
48A8D6C5-A31A-40CA-B8ED-9386733CA2BE
Response Headers
Access-Control-Allow-Credentials true
Access-Control-Allow-Headers Origin, Content-Type, Accept, AuthToken,
Authorization, X-Authorization, X-Request-With
Access-Control-Allow-Methods GET, POST, PUT, DELETE, OPTIONS
Access-Control-Allow-Origin *
AuthToken
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXUyJ9.eyJ1c2VybmFtZSI6ImFqb3NsaW4iLCJzdWIiOjUwLCJpc3MiOiJodHRwOlwvXC9sb2NhbGhvc3Q6ODAwMFwvYXBpXC9ib29rbGV0XC8xMSIsImlhdCI6IjE0MzUwOTY4MTEiLCJleHAiOiIxNDM1MTAwNDMwIiwibmJmIjoiMTQzNTA5NjgzMCIsImp0aSI6IjUwMDBjNmZiMjk3ZmU4MWJlMWE4MjZkYTU2NzVkZmMxIn0.NzE2OTA2MjBiYWVmYmY3Yzg4ZTlhMDcwNzMxYTU1NzJjYmI1NGI3NDBjNzY4MmQwMzZhYzA5MDAzMjhiYTQ5OQ
Cache-Control no-cache
Connection close
content-type application/json
Date Tue, 23 Jun 2015 22:00:30 GMT
Host localhost:8000
Set-Cookie
laravel_session=eyJpdiI6Ijd3NE1lOGhFcmIydTZaWjBRUXRkXC93PT0iLCJ2YWx1ZSI6IldvMzBtUWQrdnlFbkc5bjErWEsyXC9rUXFsWkFmRElycmxxVElPdGJtekZSMTlUcHJkQVNvbnM5M1ExYlUwTU1MOSswXC8ybmMrSVgxZE9RQnUzYUpYNFE9PSIsIm1hYyI6IjVhZWRmMjUxMzNiOWRiMjJlMTU0OGZjYzM2MjdlODZmYzM5MDIxNjk4NWJiNjg0ZDU0MmNmN2RmN2E4OGIwMDEifQ%3D%3D;
expires=Wed, 24-Jun-2015 00:00:30 GMT; Max-Age=7200; path=/; httponly
X-Powered-By PHP/5.6.4
--
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.