Skip to content

Commit 7b2a488

Browse files
authored
Merge pull request #47412 from rkapadia15/patch-1
Code sample corrected to use HttpClient
2 parents f161d27 + 32d47f3 commit 7b2a488

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

articles/azure-functions/functions-dotnet-dependency-injection.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ using Microsoft.Azure.WebJobs;
8080
using Microsoft.Azure.WebJobs.Extensions.Http;
8181
using Microsoft.AspNetCore.Http;
8282
using Microsoft.Extensions.Logging;
83+
using System.Net.Http;
8384

8485
namespace MyNamespace
8586
{
@@ -88,10 +89,10 @@ namespace MyNamespace
8889
private readonly IMyService _service;
8990
private readonly HttpClient _client;
9091

91-
public HttpTrigger(IMyService service, IHttpClientFactory httpClientFactory)
92+
public HttpTrigger(IMyService service, HttpClient httpClient)
9293
{
9394
_service = service;
94-
_client = httpClientFactory.CreateClient();
95+
_client = httpClient;
9596
}
9697

9798
[FunctionName("GetPosts")]

0 commit comments

Comments
 (0)