@tanner0101 tanner0101 released this May 9, 2018 · 130 commits to master since this release

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

Assets 2