[Bug]: Android POST and PUT requests are not sending any data #7245
Open
Description
Capacitor Version
Latest Dependencies:
@capacitor/cli: 5.7.0
@capacitor/core: 5.7.0
@capacitor/android: 5.7.0
@capacitor/ios: 5.7.0
Installed Dependencies:
@capacitor/ios: not installed
@capacitor/cli: 5.7.0
@capacitor/core: 5.7.0
@capacitor/android: 5.7.0
Other API Details
npm 9.6.7
node v18.16.0
Platforms Affected
- iOS
- Android
- Web
Current Behavior
Doing a simple PUT request
CapacitorHttp.put({
url: "https://httpbin.org/put",
headers: { 'X-Fake-Header': 'Fake-Va2lue7' },
data: {foo:"bar"},
})
Results in
{
"data":{
"args":{},
"data":"",
"files":{},
"form":{},
"headers":{
"Accept-Encoding":"gzip",
"Accept-Language":"it-IT,it;q=0.5",
"Content-Length":"0",
"Content-Type":"application/json",
"Host":"httpbin.org",
"User-Agent":"Dalvik/2.1 .0 (Linux; U; Android 11; LEX722 Build/RQ3A.211001.001)",
"X-Amzn-Trace-Id":"Root=1-xx",
"X-Fake-Header":"Fake-Va2lue7"
},
"json":null,
"origin":"xxx",
"url":"https://httpbin.org/post"
}
}
Expected Behavior
Server should recieve the correct data
{
"data":{
"args":{},
"data":"{\"foo\":\"bar\"}",
"files":{},
"form":{},
"headers":{
"Accept-Encoding":"gzip",
"Accept-Language":"it-IT,it;q=0.5",
"Content-Length":"0",
"Content-Type":"application/x-www-form-urlencoded",
"Host":"httpbin.org",
"User-Agent":"Dalvik/2.1 .0 (Linux; U; Android 11; LEX722 Build/RQ3A.211001.001)",
"X-Amzn-Trace-Id":"Root=1-xx",
"X-Fake-Header":"Fake-Va2lue7"
},
"json":{"foo":"bar"},
"origin":"xxx",
"url":"https://httpbin.org/post"
}
}
Project Reproduction
https://github.com/LucaFontanot/cap-bug
Additional Information
Tested on two android 11 devices