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
Comments (34)
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
- Crash on GUIManager::DoGUIEvent when focusing on the Game view window on a specific project
- Asset creation in the Project Browser is not always undone/inconsistent when the undo shortcut is pressed right after creating an asset
- JobTempAlloc memory leak warning is thrown when the Player is shut down
- Graphics State Collection warm-up does not work when using with Addressables Shaders
- "Baked Shadow Radius" field is visible but inactive when when the Shadow Type is set to "Hard Shadows" under the Light Component
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
KenyAguilar
Mar 31, 2018 09:05
If you get 406 Not Acceptable I fixed it doing this.
var headers = form.headers;
Dictionary<string, string> ht = new Dictionary<string, string>();
ht["Accept"] = "*/*";
ht["Accept-Encoding"] = "gzip, deflate";
ht["User-Agent"] = "runscope/0.1";
ht["Content-Type"] = form.headers["Content-Type"].Replace("\"","");
WWW www = new WWW(url, form.data, ht);
This is also a workaround to Generic/unknown HTTP error using UnityWebRequest.