1
0
Fork 0
mirror of https://github.com/lidarr/Lidarr synced 2024-12-28 02:27:13 +00:00

Fixed: Legitimate API redirects

This commit is contained in:
Mark McDowall 2015-03-18 15:27:28 -07:00
parent ca8e16a5be
commit 9aeda7aaba

View file

@ -75,7 +75,7 @@ private void RemoveLoginHooksForApiCalls(NancyContext context)
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);