Pra*_*ash 3 javascript cookies http angularjs
这是我的 api 调用,我试图从响应头中读取 Set-Cookie
return $http(config).then(function (response) {
console.log(response.headers('Set-Cookie')); // undefined
console.log($cookies.ovrcMfa); // undefined
return response.data;
});
Run Code Online (Sandbox Code Playgroud)
和响应头是:
Access-Control-Allow-Credentials: true
Access-Control-Allow-Headers: Content-Type, Authorization, Set-Cookie, X-Requested-With, X-Session-Id, X-App-version, X-Target-Client, X-Origin-Domain, X-Dev-Mode
Access-Control-Allow-Methods: GET,PUT,POST,DELETE,OPTIONS
Access-Control-Allow-Origin: *
Access-Control-Expose-Headers: Set-Cookie
Set-Cookie : ovrc-mfa=IHfpt06ogxzLQFpwySE7vaJYg7whQ0sF; Max-Age=31536000; Path=/; Expires=Thu, 16 Jan 2020 09:30:47 GMT
Run Code Online (Sandbox Code Playgroud)
这里我想读取 Set-Cookie 值,即 ovrc-mfa
| 归档时间: |
|
| 查看次数: |
3278 次 |
| 最近记录: |