github vapor/vapor 4.57.0
Provide async closures in XCTVapor

latest releases: 4.95.0, 4.94.1, 4.94.0...
2 years ago
This patch was authored by @AndreYonadam and released by @0xTim.

This adds the ability to perform asynchronous work in the beforeRequest and afterResponse closures in XCTVapor.

E.g.

try await app.test(.GET, "/hello", beforeRequest: { req async throws in
  let currentUsersCount = try await User.query(on: app.db).count()
}, afterResponse: { res async throws in
  let newUsersCount = try await User.query(on: app.db).count()
})

Don't miss a new vapor release

NewReleases is sending notifications on new releases.