![在这里输入图片标题 输入图片说明](https://i-blog.csdnimg.cn/blog_migrate/80b272d642adea0b288b04cdadae1e2a.png)
设置表头
//form形式
private sendHttpRequest(url : string, params : any): Promise<any> {
let Interface_Address : string = ""; //接口地址
let body = new URLSearchParams();
// let commonUser = this.cookieService.getObject('loginUserId');
// console.info(commonUser)
for(let key in params){
body.set(key, params[key]);
//console.log(key);
//console.log(params[key]);
}
let headers = new Headers({'Content-Type' : 'application/x-www-form-urlencoded;charset=UTF-8'});
// headers.set("Cookies", this.cookieService.getObject('loginUserId'));
//继承登录的cookie withCredentials: true
let options = new RequestOptions({headers : headers, withCredentials: true});
return this.http
.post( Interface_Address+url , body , options)
.toPromise()
.then( this.extractData );
}