Skip to content

Commit 2155896

Browse files
fix: make iOS requests recognized by backend (#159)
Adds simple user-agent to make gonfalon recognize iOS. Later should be made proper but it should be here until gonfalon update Later should be similar to this // func buildUserAgent(sdkVersion: String) -> String { // let device = UIDevice.current // let osVersion = device.systemVersion.replacingOccurrences(of: ".", with: "_") // let model = device.model // "iPhone" or "iPad" // let buildNumber = Bundle.main.infoDictionary?["CFBundleVersion"] as? String ?? "0" // // if model == "iPad" { // return "Mozilla/5.0 (\(model); CPU OS \(osVersion) like Mac OS X) Mobile/\(buildNumber) YourSDK/\(sdkVersion)" // } else { // return "Mozilla/5.0 (\(model); CPU \(model) OS \(osVersion) like Mac OS X) Mobile/\(buildNumber) YourSDK/\(sdkVersion)" // } // } <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Low risk: adds a static `User-Agent` default header to outgoing GraphQL requests, with no change to request/response handling beyond the extra header. > > **Overview** > Adds a default `User-Agent: iOS` header to `GraphQLClient`’s `defaultHeaders`, ensuring all GraphQL requests identify as iOS unless explicitly overridden by per-call headers. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 164b955. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
1 parent 17a5475 commit 2155896

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Sources/Common/GraphQL/GraphQLClient.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ public final class GraphQLClient {
1313
decoder: JSONDecoder = JSONDecoder(),
1414
defaultHeaders: [String: String] = [
1515
"Content-Type": "application/json",
16-
"Accept": "application/json"
16+
"Accept": "application/json",
17+
"User-Agent": "iOS"
1718
]) {
1819
self.endpoint = endpoint
1920
self.network = network

0 commit comments

Comments
 (0)