Search Issue Tracker
Fixed in 2017.3.0f3
Votes
2
Found in
2017.3.0b5
Issue ID
960676
Regression
Yes
[Networking] UnityWebRequest.Post returns "Generic/unknown HTTP error"
Steps to reproduce:
1. Open attached project
2. Play the scene
3. Notice the WebRequest Error: Generic/unknown HTTP error
Expected result: console should print: Return data: post field is set instead
Reproduced in: 2018.1.0a1, 2017.3.0b5, 2017.3.0b1
Not reproduced in: 2017.3.0a7, 2017.2.0f3
Regression since: 2017.3.0b1
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
- [Dragon Crashers] Build fails in U6
- [Dragon Crashers] 4 Shader error messages on import
- [Dragon Crashers] Readme text is white on light grey
- Cursor stays in front of the first character when entering text in the TextMeshPro field
- Searching in Hierarchy causes unwanted component calls
Baalair
Oct 05, 2018 22:39
I was experiencing this issue with 20182.2f1. The work around for the Post method shown here fixed it for me:
https://codetolight.wordpress.com/2017/01/18/unity-rest-api-interaction-with-unitywebrequest-and-besthttp/
Just remember to add an Access Token to the request header if you need to.
guneyozsan
Sep 20, 2018 03:09
I still get this on 2018.2.6f1. Setting chunk false does not do any good. Any workarounds?
mustafaneguib88
May 07, 2018 19:03
I am using Unity3d 2017.4.2f2 and I am getting this error as well.
Following is my HTTP POST request:
List<IMultipartFormSection> formData = new List<IMultipartFormSection>();
formData.Add(new MultipartFormDataSection("email="+email+"&name="+name));
UnityWebRequest www = UnityWebRequest.Post(Utility.BASE_URL + Utility.LOGIN, formData);
www.chunkedTransfer = false;
yield return www.SendWebRequest();
if (www.isNetworkError || www.isHttpError)
{
Debug.Log(www.error);
}
else
{
Debug.Log(www.downloadHandler.text);
}
citron8000
May 07, 2018 12:08
This is not fixed in 2017..3.1p4 either. I tried all workarounds in this thread with no luck. I get a Generic/unknown HTTP error while it's works with Postman.
citron8000
May 07, 2018 11:54
This is not fixed in 2017..3.1p2
PXtreme
Apr 27, 2018 06:54
I use UnityWebRequest and I am on 2017.4.0f1, and I have tried all work arounds from different forums. From changing chunkedTransfer to false, Using Put, but changing the method to "POST", Adding .SetRequestHeader ("X-HTTP-Method-Override", method), trying uploadhandler and downloadhandler. I tried sending raw JSON on Postman and the request was received but in Unity, it just gives me "Generic/unknown HTTP error". Please help.
baumerj
Apr 25, 2018 20:22
Figured this out and it works now! Version 2017.3.1f1. Here's the code:
string accessUri = "";
string data1 = "";
string data2 = "";
WWWForm form = new WWWForm();
form.AddField("data1", data1);
form.AddField("data2", data2);
using (UnityWebRequest www = UnityWebRequest.Post(accessUri, form)) {
yield return www.SendWebRequest();
if (www.isNetworkError || www.isHttpError) {
Debug.Log(www.error);
} else {
Debug.Log("Form upload complete!");
}
}
baumerj
Apr 25, 2018 15:18
@ARESUNDNES - Can you post your code as an example? I tried www.chunkedTransfer = false; and am still getting the error.
aresundnes
Apr 24, 2018 10:29
The issue is resolved for me by setting chunkedTransfer to false:
```
UnityWebRequest www = UnityWebRequest.Post(url, formData);
www.chunkedTransfer = false;
```
Steamc0re
Apr 11, 2018 23:37
Not fixed. Still get in 2017.4.0f1