Skip to content

Commit

Permalink
Update to PotentCodables 2.4.1
Browse files Browse the repository at this point in the history
* `Parameters` type is now an `OrderedDictionary` to match new unwrapping of `AnyValueEncoder`.
  • Loading branch information
kdubb committed Jan 18, 2023
1 parent 2281dcb commit fe4bda1
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
],
Expand Down
3 changes: 2 additions & 1 deletion Sources/Sunday/HTTP.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/

import Foundation
import OrderedCollections


public struct HTTP {
Expand Down Expand Up @@ -159,7 +160,7 @@ public struct HTTP {
}


public typealias Parameters = [String: Any?]
public typealias Parameters = OrderedDictionary<String, Any?>


public extension URL {
Expand Down
2 changes: 1 addition & 1 deletion Sources/Sunday/HeaderParameters.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Sources/Sunday/WWWFormURLEncoder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public struct WWWFormURLEncoder: MediaTypeEncoder {

public func encode<T>(_ 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
}

Expand Down

0 comments on commit fe4bda1

Please sign in to comment.