lundi 29 mars 2021

UnityWebRequest cannot receive data in some urls response

I have some problems with UnityWebRequest.

I have several URLs to communicating with my server. Some URLs working fine expectly and other few URLs not working expectly.

It's a weird thing that there is no error in any unity and my server. My server respond with status 200 normally, but Unity client cannot receive any data from the server. (And later showed unity editor curl error 42 callback aborted in console) So I had testing my server on POSTMAN, Restlet Client, Curl, and even testing Axios on javascript. and it's working perfectly. and I think response data size does not matter about this problem because other working URLs data is the much bigger than response data size

I don't know why UnityWebRequest cannot receive any data in some URLs responses.

My web server using spring framework and unity client version is 2019.2.12f1 and I tried 2019.3.0.f1 but it's not working too.

I think there is no matter about the server because the server respond with 200 and done with communication.

Thanks for reading my problem and please give me some advice about solving this problem.

UPDATE:

here is my request code

private IEnumerator SendPutRequest() {
        var req = new UnityWebRequest("not/wokring/uri") {
            downloadHandler = new DownloadHandlerBuffer(),
            uploadHandler = new UploadHandlerRaw(Encoding.UTF8.GetBytes(requestBody)) {
                contentType = "application/json"
            }
        };
        req.SetRequestHeader("Authorization", "ACCESS TOKEN");
        req.method = UnityWebRequest.kHttpVerbPUT;

        yield return req.SendWebRequest();

        Logger.Debug(this, req.downloadHandler.text);
    }



Aucun commentaire:

Enregistrer un commentaire