I'm pining a Rasa server through Ngrok and postman is working fine..
it was working in few test, but then like 3rd time test.. the return text will be empty
any possible reason?
I'm using Unity 2018.0.3.f2
Windows 10
I'm building it for android and Ios (unity cloud build)
here my code in posting
IEnumerator PostRequest_(string url, string json)
{
Debug.Log(url);
var uwr = new UnityWebRequest(url, "POST");
byte[] jsonToSend = new System.Text.UTF8Encoding().GetBytes(json);
uwr.uploadHandler = (UploadHandler)new UploadHandlerRaw(jsonToSend);
uwr.downloadHandler = (DownloadHandler)new DownloadHandlerBuffer();
uwr.SetRequestHeader("Content-Type", "application/json");
uwr.SetRequestHeader("Cache-Control", "no-cache");
uwr.SetRequestHeader("Pragma", "no-cache");
uwr.SetRequestHeader("Accept", "*/*");
uwr.SetRequestHeader("Accept-Encoding", "gzip, deflate");
yield return uwr.SendWebRequest();
if (uwr.isNetworkError)
{
Debug.Log("Error While Sending: " + uwr.error);
}
else
{
Debug.Log("Received: " + uwr.downloadHandler.text);
itemData = JsonMapper.ToObject(uwr.downloadHandler.text);
bool hasElement = false;
foreach (var element in itemData)
{
hasElement = true;
break;
}
if (hasElement){
TTSObj.OnInputText(itemData [0]["text"].ToString());
}else {
Debug.Log("Received: Empty");
}
}
↧