diff --git a/src/UniTask/Assets/Plugins/UniTask/Runtime/UnityWebRequestException.cs b/src/UniTask/Assets/Plugins/UniTask/Runtime/UnityWebRequestException.cs index efd1565..9a164ab 100644 --- a/src/UniTask/Assets/Plugins/UniTask/Runtime/UnityWebRequestException.cs +++ b/src/UniTask/Assets/Plugins/UniTask/Runtime/UnityWebRequestException.cs @@ -33,7 +33,10 @@ namespace Cysharp.Threading.Tasks this.ResponseCode = unityWebRequest.responseCode; if (UnityWebRequest.downloadHandler != null) { - this.Text = unityWebRequest.downloadHandler.text; + if (unityWebRequest.downloadHandler is DownloadHandlerBuffer dhb) + { + this.Text = dhb.text; + } } } diff --git a/src/UniTask/Assets/Scenes/SandboxMain.cs b/src/UniTask/Assets/Scenes/SandboxMain.cs index f84ced7..a96fb90 100644 --- a/src/UniTask/Assets/Scenes/SandboxMain.cs +++ b/src/UniTask/Assets/Scenes/SandboxMain.cs @@ -476,8 +476,8 @@ public class SandboxMain : MonoBehaviour async UniTaskVoid Start() { - var url = "http://fooooooooooooooooooooooooooooooooooo.com"; - var webRequestAsyncOperation = UnityWebRequest.Head(url).SendWebRequest(); + var url = "http://google.com/404"; + var webRequestAsyncOperation = UnityWebRequest.Get(url).SendWebRequest(); await webRequestAsyncOperation.ToUniTask(); //PlayerLoopInfo.Inject();