From 1723226ad928fb621965a178e19eb7a61db58b97 Mon Sep 17 00:00:00 2001 From: Guilherme Souza Date: Tue, 28 Apr 2026 04:49:40 -0300 Subject: [PATCH 1/2] feat(supabase): consolidate client metadata into structured X-Client-Info header MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace separate X-Supabase-Client-Platform and X-Supabase-Client-Platform-Version headers with a single semicolon-delimited X-Client-Info value: supabase-swift/2.45.0; platform=iOS; platform-version=18.5.0; runtime=swift; runtime-version=5.10 This avoids the need to add new HTTP headers for future metadata fields. Adding a new header in supabase-js is a breaking change because users must explicitly allow headers in their CORS config when running in Edge Functions — X-Client-Info is already in every allowlist. Also adds runtime (always "swift") and runtime-version (detected at compile time via #if swift(...) chain) which were not previously sent. Co-Authored-By: Claude Sonnet 4.6 --- Sources/Helpers/Version.swift | 22 ++++++++++++++++++++++ Sources/Supabase/Constants.swift | 13 +++++++------ 2 files changed, 29 insertions(+), 6 deletions(-) diff --git a/Sources/Helpers/Version.swift b/Sources/Helpers/Version.swift index 624f9f641..b6a8b557b 100644 --- a/Sources/Helpers/Version.swift +++ b/Sources/Helpers/Version.swift @@ -66,3 +66,25 @@ private let _platformVersion: String? = { #else package let platformVersion = _platformVersion #endif + +private let _runtimeVersion: String = { + #if swift(>=6.3) + return "6.3" + #elseif swift(>=6.2) + return "6.2" + #elseif swift(>=6.1) + return "6.1" + #elseif swift(>=6.0) + return "6.0" + #elseif swift(>=5.10) + return "5.10" + #else + return "unknown" + #endif +}() + +#if DEBUG + package let runtimeVersion = isTesting ? "0.0.0" : _runtimeVersion +#else + package let runtimeVersion = _runtimeVersion +#endif diff --git a/Sources/Supabase/Constants.swift b/Sources/Supabase/Constants.swift index 940378343..d1fd5e8b3 100644 --- a/Sources/Supabase/Constants.swift +++ b/Sources/Supabase/Constants.swift @@ -8,17 +8,18 @@ import Foundation let defaultHeaders: [String: String] = { - var headers = [ - "X-Client-Info": "supabase-swift/\(version)" - ] + var clientInfo = "supabase-swift/\(version)" if let platform { - headers["X-Supabase-Client-Platform"] = platform + clientInfo += "; platform=\(platform)" } if let platformVersion { - headers["X-Supabase-Client-Platform-Version"] = platformVersion + clientInfo += "; platform-version=\(platformVersion)" } - return headers + clientInfo += "; runtime=swift" + clientInfo += "; runtime-version=\(runtimeVersion)" + + return ["X-Client-Info": clientInfo] }() From 5ea65de073c8f12ee602aa7c05957e2273f0a2ac Mon Sep 17 00:00:00 2001 From: Guilherme Souza Date: Tue, 28 Apr 2026 04:58:51 -0300 Subject: [PATCH 2/2] test(supabase): update testClientInitialization snapshot for new X-Client-Info format Co-Authored-By: Claude Sonnet 4.6 --- Tests/SupabaseTests/SupabaseClientTests.swift | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Tests/SupabaseTests/SupabaseClientTests.swift b/Tests/SupabaseTests/SupabaseClientTests.swift index 27a120f55..05d5523b8 100644 --- a/Tests/SupabaseTests/SupabaseClientTests.swift +++ b/Tests/SupabaseTests/SupabaseClientTests.swift @@ -69,9 +69,7 @@ final class SupabaseClientTests: XCTestCase { [ "Apikey": "PUBLISHABLE_KEY", "Authorization": "Bearer PUBLISHABLE_KEY", - "X-Client-Info": "supabase-swift/0.0.0", - "X-Supabase-Client-Platform": "macOS", - "X-Supabase-Client-Platform-Version": "0.0.0", + "X-Client-Info": "supabase-swift/0.0.0; platform=macOS; platform-version=0.0.0; runtime=swift; runtime-version=0.0.0", "header_field": "header_value" ] """