fix(swift-sdk): URL-encode license key + add request tracing to kill switch
BLLicenseClient.checkStatus: percent-encode key before inserting into URL path to prevent malformed URLs with special characters. BLKillSwitchClient: add X-Product-Id and X-Request-Id headers for consistency with BLPlatformClient request tracing pattern.
This commit is contained in:
parent
b068e4bc1a
commit
77d6ff328f
@ -27,6 +27,8 @@ public final class BLKillSwitchClient {
|
||||
|
||||
var request = URLRequest(url: url)
|
||||
request.timeoutInterval = 5
|
||||
request.setValue(config.productId, forHTTPHeaderField: "X-Product-Id")
|
||||
request.setValue(UUID().uuidString, forHTTPHeaderField: "X-Request-Id")
|
||||
|
||||
do {
|
||||
let (data, response) = try await URLSession.shared.data(for: request)
|
||||
|
||||
@ -94,7 +94,8 @@ public final class BLLicenseClient {
|
||||
|
||||
/// Check license status without activating.
|
||||
public func checkStatus(key: String) async throws -> BLLicenseInfo {
|
||||
let encodedKey = key.uppercased().trimmingCharacters(in: .whitespaces)
|
||||
let trimmedKey = key.uppercased().trimmingCharacters(in: .whitespaces)
|
||||
let encodedKey = trimmedKey.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? trimmedKey
|
||||
return try await client.request(
|
||||
path: "/api/licenses/status/\(encodedKey)",
|
||||
responseType: BLLicenseInfo.self
|
||||
|
||||
Loading…
Reference in New Issue
Block a user