URLEncodedFormEncoder
Encodes Encodable
instances to application/x-www-form-urlencoded
data.
struct URLEncodedFormEncoder
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”.