Instance Methodvapor 4.106.1Vapor->RoutingKit
require(_:as:)
Grabs the named parameter from the parameter bag, casting it to a LosslessStringConvertible
type. If the parameter does not exist, Abort(.internalServerError)
is thrown. If the parameter value cannot be converted to the required type, Abort(.unprocessableEntity)
is thrown.
func require<T>(_ name: String, as type: T.Type = T.self) throws -> T where T : LosslessStringConvertible
Parameters
Other members in extension
Instance members
func require(String
) throws -> String Grabs the named parameter from the parameter bag. If the parameter does not exist,
Abort(.internalServerError)
is thrown. If the parameter value cannot be converted toString
,Abort(.unprocessableEntity)
is thrown.