Structure
URLEncodedFormDecoder
Decodes instances of
Decodable types from application/x-www-form-urlencoded data.struct URLEncodedFormDecoder
Overview
print(data) // "name=Vapor&age=3"
let user = try URLEncodedFormDecoder().decode(User.self, from: data)
print(user) // User
URL-encoded forms are commonly used by websites to send form data via POST requests. This encoding is relatively efficient for small amounts of data but must be percent-encoded. multipart/form-data is more efficient for sending larger data blobs like files, and application/json encoding has become increasingly common.
See the offical WhatWG URL standard for more information about the “URL-encoded WWW form” format.
Topics
Structures
URLEncodedFormDecoder.ConfigurationEcapsulates configuration options for URL-encoded form decoding.
Initializers
init(configuration:)Create a newURLEncodedFormDecoder.
Instance Methods
decode(_:from:)Decodes an instance of the suppliedDecodabletype from aString.decode(_:from:headers:)Legacy “decode object” method. The providedNIOCore/ByteBuffershould be decoded as a value of the given type, optionally guided by the providedHTTPHeaders.decode(_:from:headers:userInfo:)“Decode object” method. The providedNIOCore/ByteBuffershould be decoded as a value of the given type, optionally guided by the providedHTTPHeaders. The provideduserInfodictionary must be forwarded to the underlyingSwift/Decoderused to perform the decoding operation.decode(_:from:userInfo:)Decodes an instance of the suppliedDecodabletype from aString.
Relationships
Conforms To
ContentDecoderSwift.SendableSwift.SendableMetatypeURLQueryDecoder