mirror of
https://github.com/bitwarden/mobile.git
synced 2025-01-13 19:41:31 +01:00
PM-2232 Fix api response not being read as string because the content was not being considered json when it was indeed. Now Netacea messages are shown on the UI. (#2541)
This commit is contained in:
parent
e78833cbcb
commit
bebf23785d
@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@ -975,7 +976,19 @@ namespace Bit.Core.Services
|
|||||||
|
|
||||||
private bool IsJsonResponse(HttpResponseMessage response)
|
private bool IsJsonResponse(HttpResponseMessage response)
|
||||||
{
|
{
|
||||||
return (response.Content?.Headers?.ContentType?.MediaType ?? string.Empty) == "application/json";
|
if (response.Content?.Headers is null)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (response.Content.Headers.ContentType?.MediaType == "application/json")
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return response.Content.Headers.TryGetValues("Content-Type", out var vals)
|
||||||
|
&&
|
||||||
|
vals?.Any(v => v.Contains("application/json")) is true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
Loading…
Reference in New Issue
Block a user