Skip to content

Commit

Permalink
Do not add query when no parameters are present
Browse files Browse the repository at this point in the history
  • Loading branch information
mkj-is committed Jan 3, 2019
1 parent 3e6ceef commit 85f2a2f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Sources/URL+APIAdapter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ extension URL {
}

func appendingQuery(parameters: [String: String]) -> URL {
guard !parameters.isEmpty else {
return self
}
var components = URLComponents(url: self, resolvingAgainstBaseURL: true)
let oldItems = components?.queryItems ?? []
components?.queryItems = oldItems + parameters.map(URLQueryItem.init)
Expand Down

0 comments on commit 85f2a2f

Please sign in to comment.