private handleError (error: any) {
// In some advance version we can include a remote logging of errors
let errMsg = (error.message) ? error.message :
error.status ? `${error.status} - ${error.statusText}` : 'Server error';
console.error(errMsg); // Right now we are logging to console itself
return Observable.throw(errMsg);
}
startCrawlJob(crawlvalues,username,password) {
let headers = new Headers({ 'Accept': 'application/json' });
headers.append('Authorization', 'Basic ' +
btoa(username+':'+password));
let options = new RequestOptions({ headers: headers });
return this.http
.post('http://localhost:8090/Crawler_p.html',crawlvalues, options).map(res =>
res.json()
).catch(this.handleError);
}
我想用我的郵件請求發送郵件頭,但我無法在我的請求中找到任何郵件頭。上面的代碼可能是錯誤的。下面的 是Chrome中的附加請求。 Angular http post不發送郵件頭
您附加的圖像是OPTION請求,您的標題將顯示在POST請求中。 –