From 93d2e334553027ee67396d2ddd6b43d7bdd16fa8 Mon Sep 17 00:00:00 2001 From: Fabrizio Demaria Date: Tue, 19 Nov 2024 15:51:37 +0100 Subject: [PATCH] fix: Properly encoded Resolve Debug URL --- Sources/Confidence/DebugLogger.swift | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Sources/Confidence/DebugLogger.swift b/Sources/Confidence/DebugLogger.swift index 5b45fc7e..46de6df1 100644 --- a/Sources/Confidence/DebugLogger.swift +++ b/Sources/Confidence/DebugLogger.swift @@ -23,7 +23,16 @@ internal class DebugLoggerImpl: DebugLogger { let ctxNetworkValue = TypeMapper.convert(structure: context) if let ctxNetworkData = try? encoder.encode(ctxNetworkValue), let ctxNetworkString = String(data: ctxNetworkData, encoding: .utf8) { - log(messageLevel: .DEBUG, message: "[Resolve Debug] https://app.confidence.spotify.com/flags/resolver-test?client-key=\(clientKey)&flag=flags/\(flagName)&context=\(ctxNetworkString)") + var url = URLComponents() + url.scheme = "https" + url.host = "app.confidence.spotify.com" + url.path = "/flags/resolver-test" + url.queryItems = [ + URLQueryItem(name: "client-key", value: clientKey), + URLQueryItem(name: "flag", value: "flags/\(flagName)"), + URLQueryItem(name: "context", value: "\(ctxNetworkString)"), + ] + log(messageLevel: .DEBUG, message: "[Resolve Debug] \(url.url?.absoluteString ?? "N/A")") } }