From 44670a96c9cf60731e2f9c7df4c83a0921aaa621 Mon Sep 17 00:00:00 2001 From: Adam Fowler Date: Wed, 23 Oct 2024 19:53:34 +0100 Subject: [PATCH] Fix issues with discerning Handler types in ThrowingContextTransform --- Sources/HummingbirdRouter/ContextTransform.swift | 6 +++--- Sources/HummingbirdRouter/RouteGroup.swift | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Sources/HummingbirdRouter/ContextTransform.swift b/Sources/HummingbirdRouter/ContextTransform.swift index a4515c41..757d6180 100644 --- a/Sources/HummingbirdRouter/ContextTransform.swift +++ b/Sources/HummingbirdRouter/ContextTransform.swift @@ -64,7 +64,7 @@ public struct ContextTransform: RouterMiddleware where Handler.Input == Request, Handler.Output == Response, Handler.Context: RouterRequestContext & ChildRequestContext, Handler.Context.ParentContext == Context { +public struct ThrowingContextTransform: RouterMiddleware where Handler.Input == Request, Handler.Output == Response, Handler.Context == HandlerContext, HandlerContext.ParentContext == Context { public typealias Input = Request public typealias Output = Response @@ -77,8 +77,8 @@ public struct ThrowingContextTransform builder: () -> Handler + to context: HandlerContext.Type, + @MiddlewareFixedTypeBuilder builder: () -> Handler ) { self.handler = builder() } diff --git a/Sources/HummingbirdRouter/RouteGroup.swift b/Sources/HummingbirdRouter/RouteGroup.swift index 06e01042..59c2ad17 100644 --- a/Sources/HummingbirdRouter/RouteGroup.swift +++ b/Sources/HummingbirdRouter/RouteGroup.swift @@ -72,7 +72,7 @@ public struct RouteGroup builder: () -> ChildHandler - ) where ChildHandler.Context == ChildContext, Handler == ThrowingContextTransform { + ) where ChildContext == ChildContext, Handler == ThrowingContextTransform { var routerPath = routerPath // Get builder state from service context var routerBuildState = RouterBuilderState.current ?? .init(options: [])