diff options
-rw-r--r-- | Xamarin.Forms.Platform.Android/Forms.cs | 7 | ||||
-rw-r--r-- | Xamarin.Forms.Platform.iOS/Forms.cs | 7 |
2 files changed, 14 insertions, 0 deletions
diff --git a/Xamarin.Forms.Platform.Android/Forms.cs b/Xamarin.Forms.Platform.Android/Forms.cs index 1ecf76d3..3183c109 100644 --- a/Xamarin.Forms.Platform.Android/Forms.cs +++ b/Xamarin.Forms.Platform.Android/Forms.cs @@ -385,7 +385,14 @@ namespace Xamarin.Forms { using (var client = new HttpClient()) using (HttpResponseMessage response = await client.GetAsync(uri, cancellationToken)) + { + if (!response.IsSuccessStatusCode) + { + Log.Warning("HTTP Request", $"Could not retrieve {uri}, status code {response.StatusCode}"); + return null; + } return await response.Content.ReadAsStreamAsync(); + } } public IIsolatedStorageFile GetUserStoreForApplication() diff --git a/Xamarin.Forms.Platform.iOS/Forms.cs b/Xamarin.Forms.Platform.iOS/Forms.cs index 5361e13f..9b03f56d 100644 --- a/Xamarin.Forms.Platform.iOS/Forms.cs +++ b/Xamarin.Forms.Platform.iOS/Forms.cs @@ -182,7 +182,14 @@ namespace Xamarin.Forms { using (var client = GetHttpClient()) using (var response = await client.GetAsync(uri, cancellationToken)) + { + if (!response.IsSuccessStatusCode) + { + Log.Warning("HTTP Request", $"Could not retrieve {uri}, status code {response.StatusCode}"); + return null; + } return await response.Content.ReadAsStreamAsync(); + } } public IIsolatedStorageFile GetUserStoreForApplication() |