ResponseModifier
public final class ResponseModifier<E: RestEndpoint, R: CorvusResponse>:
RestEndpoint where E.Element == R.Item
A class that wraps a component which utilizes a .respond(with:)
modifier.
That allows Corvus to chain modifiers, as it gets treated as any other
struct conforming to RestEndpoint
.
-
The subject of an operation’s queries in its
.query()
method.Declaration
Swift
public typealias QuerySubject = E.QuerySubject
-
The Element that is returned by the handler.
Declaration
Swift
public typealias Element = R
-
The HTTP method of the functionality of the component.
Declaration
Swift
public let operationType: OperationType
-
An array of
PathComponent
describing the path that theTypedEndpoint
extends.Declaration
Swift
public let pathComponents: [PathComponent]
-
A method which transform the restEndpoints’s handler return value to a
Response
.Throws
AnAbort
error if something goes wrong.Declaration
Swift
public func handler(_ req: Request) throws -> EventLoopFuture<Element>
Parameters
req
An incoming
Request
.Return Value
An
EventLoopFuture
containing theResponseModifier
‘sResponse
.