JSONDataEncoding
public struct JSONDataEncoding
extension JSONDataEncoding: ParameterEncoding
-
Creates a URL request by encoding parameters and applying them onto an existing request.
Throws
An
Error
if the encoding process encounters an error.Declaration
Swift
public func encode(_ urlRequest: URLRequest, with parameters: [String : Any]?) -> URLRequest
Parameters
urlRequest
The request to have parameters applied.
parameters
The parameters to apply. This should have a single key/value pair with “jsonData” as the key and a Data object as the value.
Return Value
The encoded request.
-
Declaration
Swift
public static func encodingParameters(jsonData: Data?) -> [String : Any]?