capacitor icon indicating copy to clipboard operation
capacitor copied to clipboard

[Bug]: When CapacitorHttp is enabled, FormData does not function properly. What methods are there to solve this problem?

Open zzcraft1 opened this issue 1 year ago • 2 comments

Capacitor Version

"dependencies": { "@capacitor/android": "6.1.2", "@capacitor/app": "6.0.1", "@capacitor/camera": "^6.1.2", "@capacitor/core": "6.1.2", "@capacitor/filesystem": "6.0.2", "@capacitor/geolocation": "^6.1.0", "@capacitor/haptics": "6.0.1", "@capacitor/ios": "6.1.2", "@capacitor/keyboard": "^6.0.2", "@capacitor/preferences": "^6.0.2", "@capacitor/status-bar": "6.0.1", },

import type { CapacitorConfig } from '@capacitor/cli' const config: CapacitorConfig = { appId: 'com.xapp.app', appName: 'XApp', webDir: 'dist', server: { androidScheme: 'http', cleartext: true }, plugins: { 'CapacitorUpdater': { 'autoUpdate': false, 'statsUrl':'' }, 'Permissions': { microphone: true }, //启用http "CapacitorHttp": { enabled: true } } }当启用CapacitorHttp后,formData类型无法上传

Other API Details


Platforms Affected

  • [ ] iOS
  • [x] Android
  • [ ] Web

Current Behavior

上传文件的content-type丢失

Expected Behavior

能够正常上传form-data类型的文件

Project Reproduction

''

Additional Information

No response

zzcraft1 avatar Jul 14 '25 09:07 zzcraft1

Update to Capacitor 7, some http plugin bugs where fixed recently

jcesarmobile avatar Jul 14 '25 10:07 jcesarmobile

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Capacitor, please create a new issue and ensure the template is fully filled out.

ionitron-bot[bot] avatar Aug 13 '25 10:08 ionitron-bot[bot]