Skip to content

Commit

Permalink
Merge pull request #69 from strvcom/feat/sorted-query-parameters
Browse files Browse the repository at this point in the history
Sorted url query parameters for better caching support
  • Loading branch information
cejanen authored May 9, 2024
2 parents de68c75 + 137bf0e commit 5d7df2e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions Sources/Networking/Core/Requestable+Convenience.swift
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,12 @@ public extension Requestable {
// MARK: Build Query Items
private extension Requestable {
func buildPercentEncodedQueryItems(urlParameters: [String: Any]) -> [URLQueryItem] {
urlParameters
.map { key, value -> [URLQueryItem] in
buildPercentEncodedQueryItem(key: key, value: value)
urlParameters.keys.sorted()
.map { key -> [URLQueryItem] in
guard let value = urlParameters[key] else {
return []
}
return buildPercentEncodedQueryItem(key: key, value: value)
}
.flatMap { $0 }
}
Expand Down

0 comments on commit 5d7df2e

Please sign in to comment.