public static IEnumerator DefaultUnityWebRequest <TResponse>(RequestHelper options, Action <Exception, ResponseHelper, TResponse> callback) { using (var request = new UnityWebRequest(options.Uri, options.Method)) { yield return(request.SendWebRequest(options, options.Body)); var response = request.CreateWebResponse(); if (request.IsValidRequest(options)) { callback(null, response, JsonUtility.FromJson <TResponse>(request.downloadHandler.text)); } else { var message = request.error ?? request.downloadHandler.text; callback(new RequestException(message, request.isHttpError, request.isNetworkError, request.responseCode), response, default(TResponse)); } } }