New:
- New method
Request.makeResponse(_:as:)
for responding withHTTPBodyLosslessRepresentable
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
}
Fixed:
BlockingIOThreadPool
is now a singleton, shared across all containers (#1665).Middleware
is now applied in the correct order when usingrouter.grouped(...)
androuter.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