From 00800f338f73f4c99d3b84fad86d5a98d27bf2fb Mon Sep 17 00:00:00 2001 From: Shahroz Khan Date: Tue, 12 Nov 2024 18:56:40 +0500 Subject: [PATCH] PR suggestions --- Sources/MessagingPush/RichPush/RichPushHttpClient.swift | 2 +- Tests/MessagingPush/HttpClientTest.swift | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Sources/MessagingPush/RichPush/RichPushHttpClient.swift b/Sources/MessagingPush/RichPush/RichPushHttpClient.swift index 83478a5a9..2516fb7ee 100644 --- a/Sources/MessagingPush/RichPush/RichPushHttpClient.swift +++ b/Sources/MessagingPush/RichPush/RichPushHttpClient.swift @@ -15,7 +15,7 @@ public class RichPushHttpClient: HttpClient { [cioApiSession, publicSession] } - private var region: Region = .US + private let region: Region public func request(_ params: CioInternalCommon.HttpRequestParams, onComplete: @escaping (Result) -> Void) { httpRequestRunner diff --git a/Tests/MessagingPush/HttpClientTest.swift b/Tests/MessagingPush/HttpClientTest.swift index b1389da7f..a5233f865 100644 --- a/Tests/MessagingPush/HttpClientTest.swift +++ b/Tests/MessagingPush/HttpClientTest.swift @@ -221,6 +221,11 @@ class HttpClientTest: UnitTest { XCTAssertTrue(containsAuthorizationHeader) } + func test_getDefaultApiHost_givenRegion_expectCorrectApiHost() { + XCTAssertEqual(RichPushHttpClient.getDefaultApiHost(region: .US), "https://cdp.customer.io/v1") + XCTAssertEqual(RichPushHttpClient.getDefaultApiHost(region: .EU), "https://cdp-eu.customer.io/v1") + } + func test_getSessionForRequest_givenCIOAssetLibraryEndpoint_expectPublicSession() { let actualSession = client.getSessionForRequest(url: URL(string: "https://storage.googleapis.com/cio-asset-manager-standalone/1670599791846_frederick_adoption_day.jpg")!)