BodyParserMultiValue
public class BodyParserMultiValue : BodyParser
The BodyParserMultiValue is a subclass of BodyParser, which differs in behaviour
when decoding urlencoded parameters with multiple values (such as &a=1&a=2).
Whereas BodyParser will produce a comma-separated list of values: ["a": "1,2"]
which may be accessed by ParsedBody.urlEncoded, BodyParserMultiValue will
produce an array of values: ["a": ["1", "2"]], accessed by ParsedBody.urlEncodedMultiValue.
This enables you to accept multiple values which may themselves contain commas.
-
This function is called by the Kitura
Routerwhen an incoming request matches the route provided when the BodyParser was registered with theRouter. It performs the parsing of the body content usingparse(_:contentType). We don’t expect a user to call this function directly.Declaration
Swift
override public func handle(request: RouterRequest, response: RouterResponse, next: @escaping () -> Void) throwsParameters
requestThe
RouterRequestobject used to work with the incoming HTTP request.responseThe
RouterResponseobject used to respond to the HTTP request.nextThe closure called to invoke the next handler or middleware associated with the request.
View on GitHub
BodyParserMultiValue Class Reference