Skip to content

Commit e72c47e

Browse files
committed
fix: change _region to immutable
1 parent 1ca2c1c commit e72c47e

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

Functions/Client.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public partial class Client : IFunctionsClient
2020
{
2121
private HttpClient _httpClient = new HttpClient();
2222
private readonly string _baseUrl;
23-
private FunctionRegion _region;
23+
private readonly FunctionRegion _region;
2424

2525
/// <summary>
2626
/// Function that can be set to return dynamic headers.
@@ -128,14 +128,15 @@ private async Task<HttpResponseMessage> HandleRequest(
128128

129129
options.Headers["X-Client-Info"] = Util.GetAssemblyVersion(typeof(Client));
130130

131-
if (options.FunctionRegion != null)
131+
var region = options.FunctionRegion;
132+
if (region == null)
132133
{
133-
_region = options.FunctionRegion;
134+
region = _region;
134135
}
135136

136137
if (_region != FunctionRegion.Any)
137138
{
138-
options.Headers["x-region"] = _region.ToString();
139+
options.Headers["x-region"] = region.ToString();
139140
}
140141

141142
var builder = new UriBuilder(url);

Functions/InvokeFunctionOptions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ public bool Equals(FunctionRegion other)
164164
/// <summary>
165165
/// Overloading the operator ==
166166
/// </summary>
167-
public static bool operator ==(FunctionRegion left, FunctionRegion right) =>
167+
public static bool operator ==(FunctionRegion? left, FunctionRegion? right) =>
168168
Equals(left, right);
169169

170170
/// <summary>

0 commit comments

Comments
 (0)