Skip to content

Commit

Permalink
Fixes dotnet#5105
Browse files Browse the repository at this point in the history
Add support for HttpRequestMessage objects containing StreamContent to
the AddStandardHedgingHandler() resilience API.

This change does not update any public API contracts. It updates
internal and private API contracts only.

This is a small commit to resolve comments made on the PR.
  • Loading branch information
Adam Hammond committed Apr 19, 2024
1 parent 576fca5 commit f51e60e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public static IStandardHedgingHandlerBuilder AddStandardHedgingHandler(this IHtt
// replace the request message
args.ActionContext.Properties.Set(ResilienceKeys.RequestMessage, requestMessage);
if (route != null)
if (route is not null)
{
// replace the Host on the RequestUri of the request per the routing strategy
requestMessage.RequestUri = requestMessage.RequestUri!.ReplaceHost(route);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ bool IResettable.TryReset()
private static async Task<(HttpContent? content, HttpContent? clonedContent)> CloneContentAsync(HttpContent? content)
{
HttpContent? clonedContent = null;
if (content != null)
if (content is not null)
{
HttpContent originalContent = content;
Stream originalRequestBody = await content.ReadAsStreamAsync().ConfigureAwait(false);
Expand Down Expand Up @@ -137,7 +137,7 @@ bool IResettable.TryReset()

private bool IsInitialized()
{
return _method != null;
return _method is not null;
}

[System.Diagnostics.CodeAnalysis.SuppressMessage("Resilience", "EA0014:The async method doesn't support cancellation", Justification = "Past the point of no cancellation.")]
Expand Down

0 comments on commit f51e60e

Please sign in to comment.