From fe4bda11a2c9344b507bf032c2b0c9a1a6b3d75d Mon Sep 17 00:00:00 2001 From: Kevin Wooten Date: Wed, 18 Jan 2023 12:09:54 -0700 Subject: [PATCH] Update to PotentCodables 2.4.1 * `Parameters` type is now an `OrderedDictionary` to match new unwrapping of `AnyValueEncoder`. --- Package.swift | 2 +- Sources/Sunday/HTTP.swift | 3 ++- Sources/Sunday/HeaderParameters.swift | 2 +- Sources/Sunday/WWWFormURLEncoder.swift | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Package.swift b/Package.swift index 0eb0500a..ec5a31d2 100644 --- a/Package.swift +++ b/Package.swift @@ -21,7 +21,7 @@ let package = Package( ), ], dependencies: [ - .package(url: "https://github.com/outfoxx/PotentCodables.git", .upToNextMinor(from: "2.3.0")), + .package(url: "https://github.com/outfoxx/PotentCodables.git", .upToNextMinor(from: "2.4.1")), .package(url: "https://github.com/sharplet/Regex.git", .upToNextMinor(from: "2.1.0")), .package(url: "https://github.com/SwiftScream/URITemplate.git", .upToNextMinor(from: "2.1.0")) ], diff --git a/Sources/Sunday/HTTP.swift b/Sources/Sunday/HTTP.swift index 91a802ae..89c5543e 100644 --- a/Sources/Sunday/HTTP.swift +++ b/Sources/Sunday/HTTP.swift @@ -15,6 +15,7 @@ */ import Foundation +import OrderedCollections public struct HTTP { @@ -159,7 +160,7 @@ public struct HTTP { } -public typealias Parameters = [String: Any?] +public typealias Parameters = OrderedDictionary public extension URL { diff --git a/Sources/Sunday/HeaderParameters.swift b/Sources/Sunday/HeaderParameters.swift index a06c0312..bb36a568 100644 --- a/Sources/Sunday/HeaderParameters.swift +++ b/Sources/Sunday/HeaderParameters.swift @@ -24,7 +24,7 @@ enum HeaderParameters { case invalidEncodedValue(header: String, invalidValue: String) } - static func encode(headers: [String: Any?]) throws -> HTTP.HeaderList { + static func encode(headers: Parameters) throws -> HTTP.HeaderList { let groupedList: [(String, [String])] = try headers.compactMap { headerName, headerParameter in diff --git a/Sources/Sunday/WWWFormURLEncoder.swift b/Sources/Sunday/WWWFormURLEncoder.swift index ca7bac00..a37732e2 100644 --- a/Sources/Sunday/WWWFormURLEncoder.swift +++ b/Sources/Sunday/WWWFormURLEncoder.swift @@ -110,7 +110,7 @@ public struct WWWFormURLEncoder: MediaTypeEncoder { public func encode(_ value: T) throws -> Data where T: Encodable { - guard let parameters = try encoder.encodeTree(value).unwrappedValues as? [String: Any] else { + guard let parameters = try encoder.encodeTree(value).unwrappedValues as? Parameters else { throw Error.encodedValueNotDictionary }