当我向我部署的nodejs webserver发送一个正常的get请求时,它告诉我标题中没有发送cookie,而我已经在我的api服务的头文件中写了它
我的服务
constructor(private http: HttpClient, private global: Global) { }
verifAuth() {
return new Promise((resolve, reject) => {
this.http.get(`${this.global.url}verif`, this.global.header)
.toPromise()
.then(res => { resolve(res); })
.catch(err => { reject(err); console.log('err', err) });
});
我声明的默认标头
@Injectable({
providedIn: 'root'
})
export class Global {
url: String; header;
constructor() {
this.url = "https://fmm.etudiant.xyz/";
this.header = {
headers: new HttpHeaders({
'Content-Type': 'application/json',
'cookies': `xt=${appSetting.getString('xt')}`,
}),
withCredentials: true
};
}
}
当我调试请求时,我发现了这个
我希望必须解析令牌并获得用户的结果,但后端服务器告诉它没有cookie,而它与其他网站一起工作正常
在Http请求中发送Cookie尚不支持,有一个open feature request at Github。