Skip to content

Commit

Permalink
Make constructResponder static and publix (#316)
Browse files Browse the repository at this point in the history
  • Loading branch information
adam-fowler authored Dec 21, 2023
1 parent 550351b commit 1d4a48c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions Sources/Hummingbird/AsyncAwaitSupport/Router+async.swift
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ extension HBRouterMethods {
return on(path, method: .PATCH, options: options, use: handler)
}

func constructResponder<Output: HBResponseGenerator>(
public static func constructResponder<Output: HBResponseGenerator>(
options: HBRouterMethodOptions = [],
use closure: @escaping (HBRequest) async throws -> Output
) -> HBResponder {
Expand Down Expand Up @@ -101,7 +101,7 @@ extension HBRouterBuilder {
options: HBRouterMethodOptions = [],
use closure: @escaping (HBRequest) async throws -> Output
) -> Self {
let responder = constructResponder(options: options, use: closure)
let responder = Self.constructResponder(options: options, use: closure)
add(path, method: method, responder: responder)
return self
}
Expand All @@ -116,7 +116,7 @@ extension HBRouterGroup {
options: HBRouterMethodOptions = [],
use closure: @escaping (HBRequest) async throws -> Output
) -> Self {
let responder = constructResponder(options: options, use: closure)
let responder = Self.constructResponder(options: options, use: closure)
let path = self.combinePaths(self.path, path)
self.router.add(path, method: method, responder: self.middlewares.constructResponder(finalResponder: responder))
return self
Expand Down
4 changes: 2 additions & 2 deletions Sources/Hummingbird/Router/RouterBuilder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public final class HBRouterBuilder: HBRouterMethods {
options: HBRouterMethodOptions = [],
use closure: @escaping (HBRequest) throws -> Output
) -> Self {
let responder = constructResponder(options: options, use: closure)
let responder = Self.constructResponder(options: options, use: closure)
self.add(path, method: method, responder: responder)
return self
}
Expand All @@ -95,7 +95,7 @@ public final class HBRouterBuilder: HBRouterMethods {
options: HBRouterMethodOptions = [],
use closure: @escaping (HBRequest) -> EventLoopFuture<Output>
) -> Self {
let responder = constructResponder(options: options, use: closure)
let responder = Self.constructResponder(options: options, use: closure)
self.add(path, method: method, responder: responder)
return self
}
Expand Down
4 changes: 2 additions & 2 deletions Sources/Hummingbird/Router/RouterGroup.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public struct HBRouterGroup: HBRouterMethods {
options: HBRouterMethodOptions = [],
use closure: @escaping (HBRequest) throws -> Output
) -> Self {
let responder = constructResponder(options: options, use: closure)
let responder = Self.constructResponder(options: options, use: closure)
let path = self.combinePaths(self.path, path)
self.router.add(path, method: method, responder: self.middlewares.constructResponder(finalResponder: responder))
return self
Expand All @@ -77,7 +77,7 @@ public struct HBRouterGroup: HBRouterMethods {
options: HBRouterMethodOptions = [],
use closure: @escaping (HBRequest) -> EventLoopFuture<Output>
) -> Self {
let responder = constructResponder(options: options, use: closure)
let responder = Self.constructResponder(options: options, use: closure)
let path = self.combinePaths(self.path, path)
self.router.add(path, method: method, responder: self.middlewares.constructResponder(finalResponder: responder))
return self
Expand Down
4 changes: 2 additions & 2 deletions Sources/Hummingbird/Router/RouterMethods.swift
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ extension HBRouterMethods {
}

extension HBRouterMethods {
func constructResponder<Output: HBResponseGenerator>(
public static func constructResponder<Output: HBResponseGenerator>(
options: HBRouterMethodOptions,
use closure: @escaping (HBRequest) throws -> Output
) -> HBResponder {
Expand Down Expand Up @@ -219,7 +219,7 @@ extension HBRouterMethods {
}
}

func constructResponder<Output: HBResponseGenerator>(
public static func constructResponder<Output: HBResponseGenerator>(
options: HBRouterMethodOptions,
use closure: @escaping (HBRequest) -> EventLoopFuture<Output>
) -> HBResponder {
Expand Down

0 comments on commit 1d4a48c

Please sign in to comment.