diff --git a/src/RequestLogger/Program.cs b/src/RequestLogger/Program.cs index 9388b12..8840146 100644 --- a/src/RequestLogger/Program.cs +++ b/src/RequestLogger/Program.cs @@ -76,6 +76,8 @@ // gets the customer id from a path like somePath/customer//somePath var customerId = TryGetCustomerId(context); + + var requestLoggerService = scoped.ServiceProvider.GetRequiredService(); // converts query string into a dictionary (if it has values) var queryStringDictionary = BuildQueryStringDictionary(context); @@ -94,10 +96,12 @@ RequestTime = DateTime.UtcNow }; - await SendResponse(request, context); + var requestCompleted = await requestLoggerService.WriteLogMessage(request); + + await SendResponse(requestCompleted, context); }); -async Task SendResponse(Request request, HttpContext httpContext) +async Task SendResponse(Request? request, HttpContext httpContext) { try {