如果我使用 $http 在我的服务器上发出请求,我会收到以下响应:
Request URL:http://www.test.tst/login
Request Method:GET
Status Code:200 OK
Request Headersview source
Accept:application/json, text/plain, */*
Accept-Encoding:gzip,deflate,sdch
Accept-Language:de-DE,de;q=0.8,en-US;q=0.6,en;q=0.4
Connection:keep-alive
Cookie:JSESSIONID=349AD3AC797C6AB28121ADA1766FF4A2
Host:www.test.tst
我是这样实现的:
$scope.checkToken = function () {
$http({method: 'GET', url: 'http://www.test.tst/login', params: {'action.code': 'LINK', 'linkparameter': $rootScope.token}}).
success(function (data, status, headers, config) {
console.log($cookieStore.get('JSESSIONID'));
}).
error(function (data, status, headers, config) {
$location.path("/login");
});
}
谁能告诉我,为什么 $cookieStore.get('JSESSIONID') 总是未定义?
cookie 域与我的请求来自的域相同。