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")!)