Search Issue Tracker
Fixed in 5.5.1
Votes
0
Found in
5.3.6p7
Issue ID
851921
Regression
No
UnityWebRequest POST with empty body results in Error
Steps to reproduce:
1. Open User's attached project
2. Press Play
Result: calling UnityWebRequest.Post() method results wit Error in the Console: ArgumentException: Cannot create a data handler without payload data.
Reproduced with: 5.6.0a3, 5.5.0b11, 5.4.2p4, 5.3.7p1
Note: reproduced on both Mac and Windows.
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Fixing Message Loss in UMPE During Domain Reload
- The Editor freezes when ScheduleReadOnly of IJobParallelForTransform with dependency is used
- Text is truncated in the Inspector when the display scale is set to 150%
- CancellationTokenSource(<timeout>) has incorrect cancellation status when used in WebGL Player
- VFX property value names are cut off when properties with 'Arc' are viewed in the VFX Blackboard
Rafael_CS
Jul 12, 2019 02:09
Hello guys,
replace your PUT request to this code to fix the bug.
public static UnityWebRequest Put(string uri, byte[] bodyData)
{
return new UnityWebRequest(uri, "PUT", (DownloadHandler) new DownloadHandlerBuffer(), bodyData == null || bodyData.Length == 0? null : (UploadHandler) new UploadHandlerRaw(bodyData));
}
a5thKYC
Apr 03, 2019 08:23
Still happening in 2017.4.8f1. Please fix this
bugfinders
Jan 16, 2019 16:13
Still happening in 2018.3!
Martin_Gonzalez
May 03, 2018 15:12
Still happening in 2017.4.1f1
nkillaars
Apr 30, 2018 12:29
Still happening on 2017.2.1p2 with a UnityWebRequest.Put
LiveOrDevTrying
Jan 30, 2018 14:56
Use the following code:
protected virtual IEnumerator PostEmptyBody(string route)
{
var headers = new Dictionary<string, string>
{
{ "Content-Type", "application/json" }
};
var packetToSend = JsonUtility.ToJson(string.Empty);
var body = Encoding.UTF8.GetBytes(packetToSend);
var www = new WWW(route, body, headers);
yield return www;
if (!string.IsNullOrEmpty(www.error))
{
Debug.Log(www.error);
}
}
Cheers,
mario-m911
Jun 14, 2017 03:46
Still happening on 5.6.1f1