Skip to content

Commit

Permalink
Fix issues with discerning Handler types in ThrowingContextTransform
Browse files Browse the repository at this point in the history
  • Loading branch information
adam-fowler committed Oct 23, 2024
1 parent a65b1bf commit 44670a9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions Sources/HummingbirdRouter/ContextTransform.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public struct ContextTransform<Context: RouterRequestContext, HandlerContext: Ro

/// Router middleware that transforms the ``Hummingbird/RequestContext`` and uses it with the contained
/// Middleware chain. ``Used by RouteGroup/init(_:context:builder:)``
public struct ThrowingContextTransform<Context: RouterRequestContext, Handler: MiddlewareProtocol>: RouterMiddleware where Handler.Input == Request, Handler.Output == Response, Handler.Context: RouterRequestContext & ChildRequestContext, Handler.Context.ParentContext == Context {
public struct ThrowingContextTransform<Context: RouterRequestContext, HandlerContext: RouterRequestContext & ChildRequestContext, Handler: MiddlewareProtocol>: RouterMiddleware where Handler.Input == Request, Handler.Output == Response, Handler.Context == HandlerContext, HandlerContext.ParentContext == Context {
public typealias Input = Request
public typealias Output = Response

Expand All @@ -77,8 +77,8 @@ public struct ThrowingContextTransform<Context: RouterRequestContext, Handler: M
/// - context: RequestContext to convert to
/// - builder: RouteGroup builder
public init(
to context: Handler.Context.Type,
@MiddlewareFixedTypeBuilder<Request, Response, Handler.Context> builder: () -> Handler
to context: HandlerContext.Type,
@MiddlewareFixedTypeBuilder<Request, Response, HandlerContext> builder: () -> Handler
) {
self.handler = builder()
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/HummingbirdRouter/RouteGroup.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public struct RouteGroup<Context: RouterRequestContext, Handler: MiddlewareProto
_ routerPath: RouterPath,
context: ChildContext.Type,
@MiddlewareFixedTypeBuilder<Request, Response, ChildContext> builder: () -> ChildHandler
) where ChildHandler.Context == ChildContext, Handler == ThrowingContextTransform<Context, ChildHandler> {
) where ChildContext == ChildContext, Handler == ThrowingContextTransform<Context, ChildContext, ChildHandler> {
var routerPath = routerPath
// Get builder state from service context
var routerBuildState = RouterBuilderState.current ?? .init(options: [])
Expand Down

0 comments on commit 44670a9

Please sign in to comment.