private IEnumerator SendHttpRequest(string jsonStr, Action<string> callBack)
{
string url = webModel.serverAddress + webModel.tokenAddress;
UnityWebRequest request = UnityWebRequest.Post(url, "POST");
request.SetRequestHeader("Content-Type", "application/json");
request.uploadHandler = new UploadHandlerRaw(Encoding.UTF8.GetBytes(jsonStr));
yield return request.SendWebRequest();
if (request.isHttpError || request.isNetworkError)
{
Debug.LogError(request.error);
}
else
{
string code = request.downloadHandler.text;
callBack?.Invoke(code);
}
}