Skip to content

Commit 944e1f5

Browse files
committed
resolve comments
1 parent 436c6ed commit 944e1f5

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

src/WebJobs.Script/Workers/Http/Configuration/HttpWorkerOptions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ public class HttpWorkerOptions
1616
public int Port { get; set; }
1717

1818
/// <summary>
19-
/// Setting that enables the host to rebuild the initial invocation HTTP Request and send the copy to the worker process.
19+
/// Gets or sets a value indicating whether the host will rebuild the initial invocation HTTP Request and send the copy to the worker process.
2020
/// </summary>
2121
public bool EnableForwardingHttpRequest { get; set; }
2222

2323
/// <summary>
24-
/// Setting that enables YARP to proxy the invocation HTTP request to the worker process.
24+
/// Gets or sets a value indicating whether the host will proxy the invocation HTTP request to the worker process.
2525
/// </summary>
2626
public bool EnableProxyingHttpRequest { get; set; }
2727

src/WebJobs.Script/Workers/Http/Configuration/HttpWorkerOptionsSetup.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public void Configure(HttpWorkerOptions options)
4646
ConfigureWorkerDescription(options, customHandlerSection);
4747
if (options.Type == CustomHandlerType.None)
4848
{
49-
// CustomHandlerType.None is only for maintaining backward compatibilty with httpWorker section.
49+
// CustomHandlerType.None is only for maintaining backward compatability with httpWorker section.
5050
_logger.LogWarning($"CustomHandlerType {CustomHandlerType.None} is not supported. Defaulting to {CustomHandlerType.Http}.");
5151
options.Type = CustomHandlerType.Http;
5252
}

src/WebJobs.Script/Workers/Http/DefaultHttpWorkerService.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public class DefaultHttpWorkerService : IHttpWorkerService
2727
private readonly IHttpProxyService _httpProxyService;
2828
private readonly ScriptInvocationResult _successfulInvocationResult;
2929
private readonly Uri _destinationPrefix;
30+
private readonly string _userAgentString;
3031

3132
public DefaultHttpWorkerService(IOptions<HttpWorkerOptions> httpWorkerOptions, ILoggerFactory loggerFactory, IEnvironment environment,
3233
IOptions<ScriptJobHostOptions> scriptHostOptions, IHttpProxyService httpProxyService)
@@ -60,6 +61,7 @@ internal DefaultHttpWorkerService(HttpClient httpClient, IOptions<HttpWorkerOpti
6061
};
6162

6263
_destinationPrefix = new UriBuilder(WorkerConstants.HttpScheme, WorkerConstants.HostName, _httpWorkerOptions.Port).Uri;
64+
_userAgentString = $"{HttpWorkerConstants.UserAgentHeaderValue}/{ScriptHost.Version}";
6365
}
6466

6567
private static HttpClient CreateHttpClient(IOptions<HttpWorkerOptions> httpWorkerOptions)
@@ -203,10 +205,10 @@ internal void AddHeaders(HttpRequestMessage httpRequest, string invocationId)
203205
{
204206
httpRequest.Headers.Add(HttpWorkerConstants.HostVersionHeaderName, ScriptHost.Version);
205207
httpRequest.Headers.Add(HttpWorkerConstants.InvocationIdHeaderName, invocationId);
206-
httpRequest.Headers.UserAgent.ParseAdd($"{HttpWorkerConstants.UserAgentHeaderValue}/{ScriptHost.Version}");
208+
httpRequest.Headers.UserAgent.ParseAdd(_userAgentString);
207209
}
208210

209-
internal void AddProxyingHeaders(HttpRequest httpRequest, string invocationId)
211+
private void AddProxyingHeaders(HttpRequest httpRequest, string invocationId)
210212
{
211213
httpRequest.Headers.TryAdd(HttpWorkerConstants.HostVersionHeaderName, ScriptHost.Version);
212214

@@ -215,9 +217,7 @@ internal void AddProxyingHeaders(HttpRequest httpRequest, string invocationId)
215217
httpRequest.Headers[HttpWorkerConstants.InvocationIdHeaderName] = invocationId;
216218
}
217219

218-
var userAgent = $"{HttpWorkerConstants.UserAgentHeaderValue}/{ScriptHost.Version}";
219-
httpRequest.Headers.Remove("User-Agent");
220-
httpRequest.Headers.Append("User-Agent", userAgent);
220+
httpRequest.Headers.UserAgent = _userAgentString;
221221
}
222222

223223
internal string GetPathValue(HttpWorkerOptions httpWorkerOptions, string functionName, HttpRequest httpRequest)

0 commit comments

Comments
 (0)