Files
ccn/Packages/Infrastructure/Tests/Utils/Controllers/StubController.swift
T

31 lines
617 B
Swift
Raw Normal View History

2026-08-19 22:55:00 +02:00
import Hummingbird
import Infrastructure
/// A controller serving its path back as plain text, used to observe route registration.
struct StubController {
// MARK: Properties
/// The path the controller serves, also returned as the response body.
let path: String
}
// MARK: - RouterController
extension StubController: RouterController {
// MARK: Properties
var routes: RouteCollection<BasicRequestContext> {
let routes = RouteCollection(context: BasicRequestContext.self)
routes.get(.init(path)) { _, _ in
self.path
}
return routes
}
}