github vapor/vapor 4.0.0-beta.3.19
Add Application.Responder for configuring responder

latest releases: 4.99.3, 4.99.2, 4.99.1...
pre-release4 years ago

Adds Application.Responder helper for configuring which Responder the application will use. This works similarly to Application.Sessions (fixes #2181, #2185).

The application can be configured to use the default responder or a custom one.

app.responder.use(.default)
app.responder.use(.foo)
// or
app.responder.use { app in
    FooResponder(routes: app.routes)
}

Leading dot-syntax can be achieved by extending Application.Responder.Provider.

Vapor exposes .default and app.responder.default which return a DefaultResponder.

To create a responder, use current:

app.responder.current.respond(to: ...)

Application.Responder conforms to Responder for backward compatibility. This creates a new instance of the responder for each call, so storing app.responder.current should be used where performance is important.

app.responder.respond(to: ...)

Don't miss a new vapor release

NewReleases is sending notifications on new releases.