[Bug]: Android Capacitor Returns UTF-8 Binary String Instead of Blob for Binary Responses #7944
Open
1 of 3 tasks
Labels
needs reproduction
needs reproducible example to illustrate the issue
Capacitor Version
Capacitor Doctor
Latest Dependencies:
@capacitor/cli: 7.1.0
@capacitor/core: 7.1.0
@capacitor/android:
7.1.0
@capacitor/ios: 7.1.0
Installed Dependencies:
@capacitor/ios: not installed
@capacitor/cli: 7.1.0
@capacitor/core: 7.1.0
@capacitor/android: 7.1.0
[success] Android looking great! 👌
Other API Details
Platforms Affected
Current Behavior
When making network requests with
responseType: 'blob'
on Android with Capacitor, instead of receiving a proper Blob object like on web platforms, the response is a UTF-8 encoded binary string. This inconsistency causes issues when trying to handle binary data like audio files across different platforms.response.data
is a proper Blob objectresponse.data
is a UTF-8 encoded binary stringExpected Behavior
When making a request with
responseType: 'blob'
, the response should be a standard Blob object on all platforms (web and Android), allowing consistent code handling.Project Reproduction
https://gist.github.com/layola13/55bd89421c9e82d066d584b80f0da551
Additional Information
This inconsistency makes it difficult to handle binary responses in a cross-platform manner. Ideally, Capacitor should normalize the response type to be consistent with web behavior, returning a proper Blob object when
responseType: 'blob'
is specified.The text was updated successfully, but these errors were encountered: