CSharpHttpServer/SimpleHttpServer/HttpEndpoint.cs
2024-01-09 04:28:45 +01:00

23 lines
702 B
C#

using SimpleHttpServer.Internal;
namespace SimpleHttpServer;
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
public class HttpEndpoint<T> : Attribute where T : IAuthorizer {
public HttpRequestType Type { get; private set; }
public string Location { get; private set; }
public Type Authorizer { get; private set; }
public HttpEndpoint(HttpRequestType type, string location) {
Type = type;
Location = location;
Authorizer = typeof(T);
}
}
[AttributeUsage(AttributeTargets.Method)]
public class HttpEndpoint : HttpEndpoint<DefaultAuthorizer> {
public HttpEndpoint(HttpRequestType type, string location) : base(type, location) { }
}