Reputation: 17132
I'm trying to perform a GET request to download a PDF document to the phone. The responseType
is blob
as I need the result as a Blob file.
import {
HttpClient
} from '@angular/common/http';
this.httpClient
.get(specSheet.link, {
responseType: 'blob'
})
.subscribe(result => {
console.log('http client download result: ', result)
Everything works as expected on web and ran in Chrome. http client download result: Blob {size: 174016, type: "application/pdf"}
But on iOS or Android the result is empty http client download result: {}
.
What am I missing? Any help is greatly appreciated.
PS: Here's a simple playground just downloading a test image: https://github.com/davidseek/ionic-playground
It works perfectly fine ran on web. But not at all on a physical device. Web result is a Blob, phone result is empty: {}
Upvotes: 1
Views: 2399
Reputation: 53341
That's just the console plugin not being able to display complex objects on the Xcode console.
If you debug the app using Safari remote inspector you'll see the actual blob.
Upvotes: 2