Skip to content

Support custom coding keys! 🎉

Compare
Choose a tag to compare
@MihaelIsaev MihaelIsaev released this 07 Nov 06:10
· 65 commits to master since this release

Use DictionaryEncoder for headers, so now you could define your custom coding keys e.g. like this

struct Headers: Codable {
        var platform: String?
        var sdk: String?
        var version: String?
        var id: String?
        
        enum CodingKeys: String, CodingKey {
            case platform = "X-Mobile-Platform"
            case sdk = "X-Mobile-SDK"
            case version = "X-Mobile-A"
            case id = "X-Mobile-ID"
        }
    }

Use DictionaryEncoder for multipart
Implement FormURLEncodedPayload protocol and sendFormURLEncoded method
Conform PayloadProtocol to just Encodable
Conform ResultType to just Decodable
Rename buildQuery(_) into buildURLEncodedString(from:)
Improve error messages printing, now use Logger instead of just printing
Update Example project to demonstrate custom coding keys for headers
Update readme, add info