File tree Expand file tree Collapse file tree 2 files changed +2
-7
lines changed Expand file tree Collapse file tree 2 files changed +2
-7
lines changed Original file line number Diff line number Diff line change @@ -101,7 +101,7 @@ class DefaultCmabClient: CmabClient {
101101 }
102102
103103 func getUrl( ruleId: String ) -> URL ? {
104- let urlString = " \( predictionEndpoint) / \( ruleId) "
104+ let urlString = predictionEndpoint . hasSuffix ( " / " ) ? " predictionEndpoint \( ruleId ) " : " \( predictionEndpoint) / \( ruleId) "
105105 guard let url = URL ( string: urlString) else {
106106 self . logger. e ( " Invalid CMAB endpoint " )
107107 return nil
Original file line number Diff line number Diff line change @@ -40,12 +40,7 @@ public struct CmabConfig {
4040 self . cacheSize = cacheSize
4141 self . cacheTimeoutInSecs = cacheTimeoutInSecs
4242 // Sanitize and validate endpoint
43- if let endpoint = predictionEndpoint? . trimmingCharacters ( in: . whitespaces) , !endpoint. isEmpty {
44- // Remove trailing slashes
45- var sanitized = endpoint
46- if sanitized. hasSuffix ( " / " ) {
47- sanitized = String ( sanitized. dropLast ( ) )
48- }
43+ if let sanitized = predictionEndpoint? . trimmingCharacters ( in: . whitespaces) , !sanitized. isEmpty {
4944 self . predictionEndpoint = sanitized
5045 } else {
5146 self . predictionEndpoint = CMAB_PREDICTION_END_POINT
You can’t perform that action at this time.
0 commit comments