9 lines
208 B
Swift
9 lines
208 B
Swift
import Vapor
|
|
|
|
extension Request {
|
|
func ensureValidContent<T>(_ decoding: T.Type) throws -> T where T: Content, T: Validatable {
|
|
try T.validate(content: self)
|
|
return try content.decode(T.self)
|
|
}
|
|
}
|