HttpClient DelegatingHandler 无法正常工作

问题描述 投票:0回答:0

我们正在使用 HTTP 客户端和 DelegatingHandler 来记录传出的 API 请求。 我们的系统环境包括两个区域,测试和生产。我在测试环境中没有遇到任何问题,但是在生产环境中有一个问题我没有解决。我们的问题是在生产环境中参数字段时而满时而空。 (在应该满的情况下)。我还没弄明白为什么会出现这个问题。

您可以在下面找到我们的代码 首先,我们正在读取我们发送的请求中的传出参数。

requestContent= await response.Content.ReadAsStringAsync(cancellationToken);

之后,我们在 auditLog 类中使用这些信息

AuditLogActionInfo actionInfo = new()
        {
            ExecutionDuration = executionDuration,
            ExecutionTime = DateTime.Now,
            MethodName = request.RequestUri.GetLeftPart(UriPartial.Query),
            Parameters = requestContent
        };
c# http .net-core httpclient dotnet-httpclient
© www.soinside.com 2019 - 2024. All rights reserved.