关于它的奇怪之处在于,如果我将请求复制为cURL并使用它,则标头正在工作。
请求:
login(email, password): Observable<string> {
const url = Utils.baseBackendUrl + '/login';
const headers = new HttpHeaders({
'Content-Type': 'application/json',
});
const httpOptions = {
observe: 'response',
// method: 'POST',
// headers: headers,
};
this.http.post<any>(url, {
user_email: email,
user_password: password,
locale: 'cs_CZ'
}, {headers: headers, observe: 'response'})
.subscribe(resp => {
console.log(resp.headers);
});
return of('ahoj');
}
答案 0 :(得分:0)
最后,我为我的问题找到了一个有效的解决方案!
[
{
"alerts": {
"alertid": "3c217a81450278b38f3ad1a7260955d4",
"severity": 3,
"tally": 540,
"timestamps": [
"2018-04-21T07:37:44.512Z"
],
"type": "ALERTS"
}
}
]