Structure
URLEncodedFormEncoder
Encodes
Encodable instances to application/x-www-form-urlencoded data.struct URLEncodedFormEncoder
Overview
print(user) /// User
let data = try URLEncodedFormEncoder().encode(user)
print(data) /// Data
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 large data blobs like files.
See Mozilla’s docs for more information about url-encoded forms. NOTE: This implementation of the encoder does not support encoding booleans to “flags”.
Topics
Structures
struct ConfigurationUsed to capture URLForm Coding Configuration used for encoding.
Initializers
init(configuration: URLEncodedFormEncoder.Configuration)Create a newURLEncodedFormEncoder.
Instance Methods
func encode<E>(E, to: inout URI) throwsURLQueryEncoderconformance.func encode<E>(E, to: inout ByteBuffer, headers: inout HTTPHeaders) throwsContentEncoderconformance.func encode<E>(E, to: inout ByteBuffer, headers: inout HTTPHeaders, userInfo: [CodingUserInfoKey : any Sendable]) throwsContentEncoderconformance.func encode<E>(E, to: inout URI, userInfo: [CodingUserInfoKey : any Sendable]) throwsURLQueryEncoderconformance.func encode<E>(E, userInfo: [CodingUserInfoKey : any Sendable]) throws -> StringEncodes the suppliedEncodableobject toString.
Relationships
Conforms To
ContentEncoderSwift.SendableSwift.SendableMetatypeURLQueryEncoder