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.
Comments (7)
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
- Active quality level set on a new Universal 2D project is not the default quality level when creating a new project
- Inspector Open button does nothing when navigating to a different folder with a locked asset
- Pre-generated XML serializers fail to deserialize types that use polymorphism when the Player is built with the IL2CPP scripting backend
- Editor crashes with error "Failed to present D3D11 swapchain due to device reset/removed" and Player freezes when rendering a particle system while using modified URP package on DX11
- Crash on Scripting::LogException when async HTTP callback executes after scripting domain teardown
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