Hello,
we have problem with using UnityWebRequest to get some data from our API. On other platform’s like PC it’s working fine. On Android instead of sending GET request it send’s always POST (checked in Fiddler). It’s really weird.
Below the code snippets.
Class:
public class BaseRequest
{
protected UnityWebRequest webRequest;
public BaseRequest(string serviceUrl, string endpoint, string method)
{
webRequest = new UnityWebRequest();
webRequest.downloadHandler = new DownloadHandlerBuffer();
webRequest.url = serviceUrl + endpoint;
webRequest.method = method;
webRequest.SetRequestHeader("X-Requested-With", "XMLHttpRequest");
//...
}
public IEnumerator Send()
{
/...
yield return webRequest.SendWebRequest();
}
}
Coroutine for sending:
private IEnumerator SendSomething()
{
var request = new BaseRequest(ServiceURL, "", "GET");
yield return request.Send();
//...
}
Anyone had problem like that?