github vapor/vapor 3.0.2
Vapor 3.0.2

latest releases: 4.100.0, 4.99.3, 4.99.2...
6 years ago

New:

  • New method Request.makeResponse(_:as:) for responding with HTTPBodyLosslessRepresentable content (#1657).
// new API accepts HTTPBodyLosslessRepresentable object
router.get("hello") { req in
    return req.makeResponse("Hello!")
}

// you can also specify a content type
router.get("hello-html") { req in
    return req.makeResponse("Hey!", as: .html)
}

// existing API that accepts non-HTTPBodyLosslessRepresentable content
router.get("hello-json") { req in
    let res = req.makeResponse()
    try res.content.encode(["hello": "world"], as: .json)
    return res
}
  • New method router.on(...) that accepts a non-variadic array of path components (#1658, #1666).

Fixed:

  • BlockingIOThreadPool is now a singleton, shared across all containers (#1665).
  • Middleware is now applied in the correct order when using router.grouped(...) and router.group(...) (#1663).
  • Errors reported to Logger now correctly display the error message (#1660).

API Docs:
https://api.vapor.codes/vapor/latest/Vapor

Milestone:
3.0.2

Don't miss a new vapor release

NewReleases is sending notifications on new releases.