Angular 4.3 Httpclient不';不发送内容类型标头

Angular 4.3 Httpclient不';不发送内容类型标头,angular,Angular,如何设置httpheaders,我添加了以下代码 public post (servicio: string, item: any): Observable<any> { const url = `${SERVER_URL}${servicio}`; const headers = new HttpHeaders().set('Content-Type', 'application/json; charset=utf-8') return th

如何设置httpheaders,我添加了以下代码

  public post (servicio: string, item: any): Observable<any> 
  {
    const url = `${SERVER_URL}${servicio}`;   
    const headers = new HttpHeaders().set('Content-Type', 'application/json; charset=utf-8')
    return this.http.post(url, item, {headers: headers})
     .do(data => console.log('All: ' + JSON.stringify(data)))
     .catch(this.handleError);
  }
试一试:

var headers = new Headers();
headers.append('Content-Type', 'application/json; charset=utf-8'); 

最终作品不在标题中,在asp.net核心cors中我添加了以下内容

  app.UseCors(builder =>
              builder.WithOrigins("http://localhost:4200")
                           .AllowAnyHeader()
                           .AllowAnyMethod());
            app.UseMvc();

这是什么类型的http?HttpClient?可能与
  app.UseCors(builder =>
              builder.WithOrigins("http://localhost:4200")
                           .AllowAnyHeader()
                           .AllowAnyMethod());
            app.UseMvc();