From 389cc10c5904d452a2c8a62d623dce464d44cb32 Mon Sep 17 00:00:00 2001 From: Austin Welch <45125240+awelch6@users.noreply.github.com> Date: Sun, 9 Dec 2018 11:39:01 -0500 Subject: [PATCH] Fixed access management issue with URLComponents. Instead of overwriting the existing urlComponents.queryItems with itself and then adding the new queryItems variable on top of it. I appended the contents of the queryItems variable to urlComponents.queryItems. This fixes the access management issues, and results in slightly cleaner code. --- Sources/LyftAPI/LyftAPIURLEncoding.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/LyftAPI/LyftAPIURLEncoding.swift b/Sources/LyftAPI/LyftAPIURLEncoding.swift index 065b179..49e79d0 100644 --- a/Sources/LyftAPI/LyftAPIURLEncoding.swift +++ b/Sources/LyftAPI/LyftAPIURLEncoding.swift @@ -29,7 +29,7 @@ func lyftURLEncodedInURL(request: URLRequest, parameters: [String: Any]?) -> (UR .flatMap { components(forKey: $0, value: $1) } var urlComponents = URLComponents(url: mutableURLRequest.url!, resolvingAgainstBaseURL: false) - urlComponents?.queryItems = (urlComponents?.queryItems ?? []) + queryItems + urlComponents?.queryItems?.append(contentsOf: queryItems) mutableURLRequest.url = urlComponents?.url return (mutableURLRequest, nil) }