Qvist
December 27, 2017, 11:25am
1
Hi,
Please mark this as unresolved, since it is not fixed: Unity Issue Tracker - [Networking] UnityWebRequest.Post returns "Generic/unknown HTTP error"
I have a network layer on top of UnityWebRequest and my integration tests involving post requests fails in 2017.3.0f3
We cannot upgrade our existing projects before this is fixed.
Baste
December 27, 2017, 12:48pm
2
To get bugs looked at, you need to post a bug report with a repro case. Forum posts are not neccessarilly read by Unity staff.
Qvist
December 27, 2017, 1:52pm
3
Yeah, I just took the chance here, since the bug report I was linking to in the first post is exactly the same issue. No need to have duplicates.
But I’ll create one, if I don’t get any response here.
Same issue in Unity 2017.3.0f3 - WWW post not works (it works in POSTMAN but not in Unity)
I changed my methods from WWW to UnityWebRequest like this:
IEnumerator Post()
{
string postData = "{....post data json...}";
byte[] bytes = GetBytes(postData);
using (UnityWebRequest www = UnityWebRequest.Put("http://localhost/api/PutMethod", rawData))
{
www.SetRequestHeader("Content-Type", "application/json");
www.SetRequestHeader ("Accept", "text/json");
yield return www.Send();
if (www.isNetworkError)
{
Debug.Log(www.error);
}
else
{
Debug.Log(www.downloadHandler.text);
}
}
}
But I had to change from POST to PUT and it works