Upgrade Http to HttpClient in Angular 5: “server responded with a status of 415 (Unsupported Media Type)”
问题 I've upgraded an app from Angular 4.2 to 5 but after changed Http to HttpClient got error on POST request: error the server responded with a status of 415 (Unsupported Media Type) in app.module I've imported HttpClientModule : import { HttpClientModule } from '@angular/common/http'; Old code: post(url: string, model: any): Observable<any> { let body = JSON.stringify(model); let headers = new Headers({ 'Content-Type': 'application/json' }); let options = new RequestOptions({ headers: headers }