You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
1.3 KiB
41 lines
1.3 KiB
using System;
|
|
using Nancy;
|
|
|
|
namespace NzbDrone.Api.Extensions
|
|
{
|
|
public static class RequestExtensions
|
|
{
|
|
public static bool IsApiRequest(this Request request)
|
|
{
|
|
return request.Path.StartsWith("/api/", StringComparison.InvariantCultureIgnoreCase);
|
|
}
|
|
|
|
public static bool IsFeedRequest(this Request request)
|
|
{
|
|
return request.Path.StartsWith("/feed/", StringComparison.InvariantCultureIgnoreCase);
|
|
}
|
|
|
|
public static bool IsSignalRRequest(this Request request)
|
|
{
|
|
return request.Path.StartsWith("/signalr/", StringComparison.InvariantCultureIgnoreCase);
|
|
}
|
|
|
|
public static bool IsLocalRequest(this Request request)
|
|
{
|
|
return (request.UserHostAddress.Equals("localhost") ||
|
|
request.UserHostAddress.Equals("127.0.0.1") ||
|
|
request.UserHostAddress.Equals("::1"));
|
|
}
|
|
|
|
public static bool IsLoginRequest(this Request request)
|
|
{
|
|
return request.Path.Equals("/login", StringComparison.InvariantCultureIgnoreCase);
|
|
}
|
|
|
|
public static bool IsContentRequest(this Request request)
|
|
{
|
|
return request.Path.StartsWith("/Content/", StringComparison.InvariantCultureIgnoreCase);
|
|
}
|
|
}
|
|
}
|