Skip to content

Commit 602d00d

Browse files
committed
Implement copilot review comments
1 parent 29f76db commit 602d00d

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

OptimizelySDK/Config/DatafileProjectConfig.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -817,7 +817,9 @@ public bool IsFeatureExperiment(string experimentId)
817817
}
818818

819819
/// <summary>
820-
///Returns the datafile corresponding to ProjectConfig
820+
/// Gets or sets the region associated with the project configuration.
821+
/// This typically indicates the data residency or deployment region (e.g., "us", "eu").
822+
/// Valid values depend on the Optimizely environment and configuration.
821823
/// </summary>
822824
/// <returns>the datafile string corresponding to ProjectConfig</returns>
823825
public string ToDatafile()

OptimizelySDK/Event/Builder/EventBuilder.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -242,9 +242,11 @@ public virtual LogEvent CreateImpressionEvent(ProjectConfig config, Experiment e
242242
GetImpressionOrConversionParamsWithCommonParams(commonParams,
243243
new object[] { impressionOnlyParams });
244244

245-
var region = !string.IsNullOrEmpty(config.Region) ? config.Region : "US";
245+
var endpoint = EventFactory.EventEndpoints.ContainsKey(region)
246+
? EventFactory.EventEndpoints[region]
247+
: EventFactory.EventEndpoints["US"];
246248

247-
return new LogEvent(EventFactory.EventEndpoints[region], impressionParams, HTTP_VERB, HTTP_HEADERS);
249+
return new LogEvent(endpoint, impressionParams, HTTP_VERB, HTTP_HEADERS);
248250
}
249251

250252

@@ -270,9 +272,11 @@ public virtual LogEvent CreateConversionEvent(ProjectConfig config, string event
270272
var conversionParams =
271273
GetImpressionOrConversionParamsWithCommonParams(commonParams, conversionOnlyParams);
272274

273-
var region = !string.IsNullOrEmpty(config.Region) ? config.Region : "US";
275+
var endpoint = EventFactory.EventEndpoints.ContainsKey(region)
276+
? EventFactory.EventEndpoints[region]
277+
: EventFactory.EventEndpoints["US"];
274278

275-
return new LogEvent(EventFactory.EventEndpoints[region], conversionParams, HTTP_VERB, HTTP_HEADERS);
279+
return new LogEvent(endpoint, conversionParams, HTTP_VERB, HTTP_HEADERS);
276280
}
277281
}
278282
}

0 commit comments

Comments
 (0)