ionic-team / capacitor

Build cross-platform Native Progressive Web Apps for iOS, Android, and the Web ⚡️
https://capacitorjs.com
MIT License
11.24k stars 955 forks source link

[Bug]: NativeBridge doesn't pass responseType to native HTTP #7445

Closed SillyButt closed 1 week ago

SillyButt commented 2 weeks ago

Capacitor Version

@capacitor/cli: 5.6.0 @capacitor/core: 5.6.0 @capacitor/android: 5.6.0 @capacitor/ios: 5.6.0

Other API Details

npm: 10.5.0
node: 20.9.0

Platforms Affected

Current Behavior

When using http requests via patched by Capacitor's native-bridge XHR/Fetch with expected responseType, the Bridge doesn't pass responseType to Native HTTP (Android/iOS). This leads to Native HTTP to not process the data with expected response type.

Example: A request with responseType: 'blob' will not be treated by native HTTP as Blob and encoded to base64 rather than a plain string, despite responseType to be expected in native bridges code on Android and iOS side.

Expected Behavior

Requests with responseType: 'blob' should return Blob with valid type.

Project Reproduction

https://github.com/SillyButt/capacitor-response-type-bug-reproduction

Additional Information

A convenient visualization of the code flow CleanShot 2024-05-02 at 11 58 52@2x

jcesarmobile commented 1 week ago

This is not reproductible in Capacitor 5.7.5 nor 6.0.0, please, when reporting issues make sure you are using latest version.