|
|
@ -74,8 +74,8 @@ namespace NzbDrone.Api.Authentication
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (context.Request.IsApiRequest())
|
|
|
|
if (context.Request.IsApiRequest())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if ((context.Response.StatusCode == HttpStatusCode.SeeOther &&
|
|
|
|
if ((context.Response.StatusCode == HttpStatusCode.SeeOther &&
|
|
|
|
context.Response.ContentType.Equals("text/html", StringComparison.InvariantCultureIgnoreCase)) ||
|
|
|
|
context.Response.Headers["Location"].StartsWith("/login", StringComparison.InvariantCultureIgnoreCase)) ||
|
|
|
|
context.Response.StatusCode == HttpStatusCode.Unauthorized)
|
|
|
|
context.Response.StatusCode == HttpStatusCode.Unauthorized)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
context.Response = new { Error = "Unauthorized" }.AsResponse(HttpStatusCode.Unauthorized);
|
|
|
|
context.Response = new { Error = "Unauthorized" }.AsResponse(HttpStatusCode.Unauthorized);
|
|
|
|