docs/docsets/Kitura.docset/Contents/Resources/Documents/Enums/ParsedBody.html
public indirect enum ParsedBody
The result of parsing the body of the request.
When a body of a request is parsed the results of the parsing are placed in the associated value of the enum case based on Content-Type
`
urlEncoded(_:)
`
If the content type was “application/x-www-form-urlencoded” this associated value will contain a representation of the body as a dictionary of key-value pairs.
Swift
case urlEncoded([String : String])
`
urlEncodedMultiValue(_:)
`
If the content type was “application/x-www-form-urlencoded” this associated value will contain a representation of the body as a dictionary of key-[value] pairs.
Swift
case urlEncodedMultiValue([String : [String]])
`
text(_:)
`
If the content type was “text” this associated value will contain a representation of the body as a String.
Swift
case text(String)
`
raw(_:)
`
A raw representation of the body as a Data struct.
Swift
case raw(Data)
`
multipart(_:)
`
If the content type was “multipart/form-data” this associated value will contain an array of parts of multi-part respresentation of the body.
Swift
case multipart([Part])
`
json(_:)
`
If the content type was “application/json” this associated value will contain the body of a [String: Any] json dictionary object.
Swift
case json([String : Any])
`
asJSON
`
Extract a “JSON” body from the ParsedBody enum
Swift
public var asJSON: [String : Any]? { get }
The parsed body as a [String: Any] object, or nil if the body wasn’t in JSON format.
`
asMultiPart
`
Extract a “multipart” body from the ParsedBody enum
Swift
public var asMultiPart: [Part]? { get }
The parsed body as an array of Part structs, or nil if the body wasn’t in multi-part form format.
`
asRaw
`
Extract a “raw” body from the ParsedBody enum
Swift
public var asRaw: Data? { get }
The “raw” body as a Data, or nil if the body wasn’t in raw format.
`
asText
`
Extract a “text” body from the ParsedBody enum
Swift
public var asText: String? { get }
The “text” body as a String, or nil if the body wasn’t in text format.
`
asURLEncoded
`
Extract a “urlEncoded” body from the ParsedBody enum with comma- separated values.
Swift
public var asURLEncoded: [String : String]? { get }
The parsed body as a Dictionary, or nil if the body wasn’t in url encoded form format.
`
asURLEncodedMultiValue
`
Extract a “urlEncoded” body from the ParsedBody enum with values in an array..
Swift
public var asURLEncodedMultiValue: [String : [String]]? { get }
The parsed body as a Dictionary>, or nil if the body wasn’t in url encoded form format.