Skip to content

Commit

Permalink
dotnet format
Browse files Browse the repository at this point in the history
  • Loading branch information
marcinjahn committed Dec 9, 2024
1 parent 4fd91fc commit 6813cd2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/http/httpClient/KiotaClientFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public static IList<DelegatingHandler> CreateDefaultHandlers(IRequestOption[]? o
userAgentHandlerOption = userAgentOption;
else if(headersInspectionHandlerOption == null && option is HeadersInspectionHandlerOption headersInspectionOption)
headersInspectionHandlerOption = headersInspectionOption;
else if (bodyInspectionHandlerOption == null && option is BodyInspectionHandlerOption bodyInspectionOption)
else if(bodyInspectionHandlerOption == null && option is BodyInspectionHandlerOption bodyInspectionOption)
bodyInspectionHandlerOption = bodyInspectionOption;
}

Expand Down
14 changes: 7 additions & 7 deletions src/http/httpClient/Middleware/BodyInspectionHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ protected override async Task<HttpResponseMessage> SendAsync(
CancellationToken cancellationToken
)
{
if (request == null)
if(request == null)
throw new ArgumentNullException(nameof(request));

var options = request.GetRequestOption<BodyInspectionHandlerOption>() ?? _defaultOptions;

Activity? activity;
if (request.GetRequestOption<ObservabilityOptions>() is { } obsOptions)
if(request.GetRequestOption<ObservabilityOptions>() is { } obsOptions)
{
var activitySource = ActivitySourceRegistry.DefaultInstance.GetOrCreateActivitySource(
obsOptions.TracerInstrumentationName
Expand All @@ -58,12 +58,12 @@ CancellationToken cancellationToken
}
try
{
if (options.InspectRequestBody)
if(options.InspectRequestBody)
{
options.RequestBody = await CopyToStreamAsync(request.Content);
}
var response = await base.SendAsync(request, cancellationToken).ConfigureAwait(false);
if (options.InspectResponseBody)
if(options.InspectResponseBody)
{
options.ResponseBody = await CopyToStreamAsync(response.Content);
}
Expand All @@ -80,20 +80,20 @@ CancellationToken cancellationToken
#endif
static async Task<Stream?> CopyToStreamAsync(HttpContent? httpContent)
{
if (httpContent == null)
if(httpContent == null)
{
return null;
}

if (httpContent.Headers.ContentLength == 0)
if(httpContent.Headers.ContentLength == 0)
{
return Stream.Null;
}

var stream = new MemoryStream();
await httpContent.CopyToAsync(stream);

if (stream.CanSeek)
if(stream.CanSeek)
{
stream.Position = 0;
}
Expand Down

0 comments on commit 6813cd2

Please sign in to comment.