private void OnRespond(HTTPRequest request, HTTPResponse response)
        {
            isSending = false;

            string dataString;

            if (response == null)
            {
                Debug.Log("timeout");
                RespondData           = new RespondData();
                RespondData.errorCode = ErrorCode.Timeout;
                return;
            }

            if (response.Headers.ContainsKey("content-encoding"))
            {
                // normal flow
                try
                {
                    var decrypted    = _encryptionHelper.Decrypt(response.Data, nonce);
                    var decompressed = _encryptionHelper.GZipDecompress(decrypted);
                    dataString = _encryptionHelper.BytesToString(decompressed);
                }
                catch (Exception e)
                {
                    RespondData           = new RespondData();
                    RespondData.errorCode = ErrorCode.FailedToDecryptServerPayload;
                    return;
                }
            }
            else
            {
                // error flow
                dataString = response.DataAsText;
            }
            Debug.Log(dataString);

            RespondData = JsonUtility.FromJson <RespondData>(dataString);
            if (RespondData.errorCode == 0)
            {
                _OnRespondSuccess(RespondData);
            }
            else
            {
                _OnRespondError(RespondData);
            }
        }