我需要帮助,我正在尝试从响应中获取cookie,而我找不到方法,我对tsc和ng2很新.
这是ng2 http帖子
return this._http
.post('http://demo...', body, { headers: headers })
.subscribe(
(response: Response) => {
this.storeToken(response);
}, (err) => {
console.log('Error: ' + err);
}
);
Run Code Online (Sandbox Code Playgroud)
这是服务器响应:
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Access-Control-Allow-Origin: http://localhost:3000
Access-Control-Allow-Credentials: true
Access-Control-Allow-Headers: Content-Type, Access-Control-Allow-Headers, Authorization, X-Requested-With
Set-Cookie: JSESSIONID=A099CC4CA7A25DFBD12701630A7DC24C; Path=/pbcp/; HttpOnly
Content-Type: application/json;charset=UTF-8
Transfer-Encoding: chunked
Date: Fri, 17 Feb 2017 04:08:15 GMT
32
{"status":"OK","message":"User is Authenticated."}
0
Run Code Online (Sandbox Code Playgroud)
我很困惑,因为我在标题数组中看不到它...
的结果 console.log(response)
的结果 console.log(response.headers)
...,但我可以在cookies部分看到它.
谢谢!