URLRequest
extension URLRequest
-
Encodes the given parameters into the request.
Declaration
Swift
public mutating func setUrlEncodedFormData(_ parameters: [String : String])Parameters
parametersThe parameters to be encoded into the URLRequest.
-
Configures the URL request for
multipart/form-data. The request’shttpBodyis set, and a value is set for the HTTP header fieldContent-Type.Throws
MultipartFormDataEncodingErrorif any keys or values inparametersare not entirely inencoding.Note
The default
httpMethodisGET, andGETrequests do not typically have a response body. Remember to set thehttpMethodto e.g.POSTbefore sending the request.Declaration
Swift
public mutating func setMultipartFormData(_ parameters: [String : String], encoding: String.Encoding) throwsParameters
parametersThe form data to set.
encodingThe encoding to use for the keys and values.
URLRequest Extension Reference