initialize endpoint attributes (untested, yeet)

This commit is contained in:
00asdf 2024-07-27 00:16:38 +02:00
parent 30daf382ba
commit 2e4570a560

View File

@ -132,11 +132,12 @@ public sealed class HttpServer {
} }
// stores the check attributes that are defined on the method and on the containing class // stores the check attributes that are defined on the method and on the containing class
var requiredChecks = mi.GetCustomAttributes<InternalEndpointCheckAttribute>(true).Concat(mi.DeclaringType?.GetCustomAttributes<InternalEndpointCheckAttribute>(true) ?? Enumerable.Empty<Attribute>()) InternalEndpointCheckAttribute[] requiredChecks = mi.GetCustomAttributes<InternalEndpointCheckAttribute>(true)
.Where(a => a.GetType().IsAssignableTo(typeof(InternalEndpointCheckAttribute))).Cast<InternalEndpointCheckAttribute>().ToArray(); .Concat(mi.DeclaringType?.GetCustomAttributes<InternalEndpointCheckAttribute>(true) ?? Enumerable.Empty<Attribute>())
.Where(a => a.GetType().IsAssignableTo(typeof(InternalEndpointCheckAttribute)))
.Cast<InternalEndpointCheckAttribute>().ToArray();
foreach (var requiredCheck in requiredChecks) InternalEndpointCheckAttribute.Initialize(classInstance, requiredChecks);
requiredCheck.SetInstance(classInstance);
foreach (var location in attrib.Locations) { foreach (var location in attrib.Locations) {
var normLocation = NormalizeUrlPath(location); var normLocation = NormalizeUrlPath(location);