mirror of
				https://github.com/gnh1201/welsonjs.git
				synced 2025-10-27 02:51:17 +00:00 
			
		
		
		
	Refactor HTTP client usage in ResourceServer
Replaced local HttpClient instantiation with the class-level _httpClient for sending requests. This improves resource management and consistency in HTTP operations.
This commit is contained in:
		
							parent
							
								
									cc08c46886
								
							
						
					
					
						commit
						f44f56ea2c
					
				|  | @ -163,8 +163,6 @@ namespace WelsonJS.Launcher | |||
|                 string url = $"{prefix}{path}"; | ||||
| 
 | ||||
|                 try | ||||
|                 { | ||||
|                     using (var client = new HttpClient()) | ||||
|                 { | ||||
|                     HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, url); | ||||
|                     var ua = context?.Request?.UserAgent; | ||||
|  | @ -172,7 +170,7 @@ namespace WelsonJS.Launcher | |||
|                     { | ||||
|                         request.Headers.UserAgent.ParseAdd(ua); | ||||
|                     } | ||||
|                         HttpResponseMessage response = await client.SendAsync(request); | ||||
|                     HttpResponseMessage response = await _httpClient.SendAsync(request); | ||||
| 
 | ||||
|                     if (!response.IsSuccessStatusCode) | ||||
|                     { | ||||
|  | @ -188,7 +186,6 @@ namespace WelsonJS.Launcher | |||
| 
 | ||||
|                     return true; | ||||
|                 } | ||||
|                 } | ||||
|                 catch (Exception ex) | ||||
|                 { | ||||
|                     _logger?.Error($"Failed to serve blob. URL: {url}, Exception: {ex.Message}"); | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user