I try to download an image(png) from a api. My problem is, that for some reason only json files are accepted by ionic/angular.
return this.http.get(this.authKeys.serverURL, {headers: this.header, responseType: ResponseContentType.Blob});
Following error occurs:
Argument of type '{ headers: any; responseType: ResponseContentType.Blob; }' is not assignable to parameter of type '{ headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: "body"; params?: Ht...'. Types of property 'responseType' are incompatible. Type 'ResponseContentType.Blob' is not assignable to type '"json"'.
For some reason only a response of type json is allowed...
responseType
holds string value. So you should be passing either of these valuesIn earlier version Angular 2, it API was designed to expect enum value for
responseType
, check here