0
我這樣使用HTTP:角2餅乾未設置
private headers = new Headers({ 'Content-Type': 'application/json' })
login(loginUser: LoginUser): Promise<User> {
return this.http.post('http://localhost:9009/api/users/login', JSON.stringify(loginUser), { headers: this.headers })
.toPromise()
.then(res => res.json())
.catch(this.handleError)
}
這應該自動設置的cookie到瀏覽器,像這樣:
但沒有cookie的瀏覽器設置。
- 角版本:2.4.10
- 瀏覽器:Chrome瀏覽器56.0.2924.87(64位)|火狐52.0.2(64位)
- 語言:打字稿2.2.1
- 節點(AOT問題):節點--version = 3.10.10
響應標頭:
沒有cookie烘烤。 –
謝謝,我通過設置withCredentials = true來解決它 – ws2823147532