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.

    Parameters+Require.swift:21
    func require<T>(_ name: String, as type: T.Type = T.self) throws -> T where T : LosslessStringConvertible

    Parameters

    name

    The name of the parameter.

    type

    The required parameter value type.

    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 to String, Abort(.unprocessableEntity) is thrown.