| | 1 | | using UnityEngine.Networking; |
| | 2 | |
|
| | 3 | | namespace DCL |
| | 4 | | { |
| | 5 | | public static class WebRequestExtensions |
| | 6 | | { |
| | 7 | | public static bool WebRequestSucceded(this UnityWebRequest request) |
| | 8 | | { |
| 315 | 9 | | return request != null && |
| | 10 | | request.result == UnityWebRequest.Result.Success; |
| | 11 | | } |
| | 12 | |
|
| | 13 | | public static bool WebRequestServerError(this UnityWebRequest request) |
| | 14 | | { |
| 59 | 15 | | return request != null && |
| | 16 | | request.responseCode >= 500 && |
| | 17 | | request.responseCode < 600; |
| | 18 | | } |
| | 19 | |
|
| | 20 | | public static bool WebRequestAborted(this UnityWebRequest request) |
| | 21 | | { |
| 59 | 22 | | return request != null && |
| | 23 | | request.result == UnityWebRequest.Result.ConnectionError && |
| | 24 | | request.result == UnityWebRequest.Result.ProtocolError && |
| | 25 | | !string.IsNullOrEmpty(request.error) && |
| | 26 | | request.error.ToLower().Contains("aborted"); |
| | 27 | | } |
| | 28 | | } |
| | 29 | | } |