- Home /
Hololens UnityWebRequest raw body
Hi All,
I'm using Unity web request to do my login. On my editor, it's working fine however when I build it to Hololens, for some reason it ignore my uploadhandler.
Here's my code
var jsonString = JsonUtility.ToJson(loginModel);
var request = new UnityWebRequest(url, "POST");
byte[] bodyRaw = new System.Text.UTF8Encoding().GetBytes(jsonString);
request.uploadHandler = (UploadHandler)new UploadHandlerRaw(bodyRaw);
request.downloadHandler = (DownloadHandler)new DownloadHandlerBuffer();
request.SetRequestHeader("Content-Type", "application/json");
yield return request.SendWebRequest();
if (!request.isHttpError && !request.isNetworkError)
{
debgTx.text = request.downloadHandler.text;
}
else
{
debgTx.text = request.error;
}
Does anyone know why this happen? Thank you
Comment
Answer by Moana · Feb 21, 2018 at 10:43 AM
I am getting this same issue. It was working 3 weeks ago but now has this issue.
Hi All, i have the same problem. yield return request.SendWebRequest(); is working in editor but not on Hololens. Does anyone have a solution for this. Weeks ago it was working fine. Now i'm on 2017.3 and have this problem.
$$anonymous$$ax
Your answer
![](https://koobas.hobune.stream/wayback/20220612150735im_/https://answers.unity.com/themes/thub/images/avi.jpg)