-
Notifications
You must be signed in to change notification settings - Fork 6k
[Resilient HTTP apps] Add a paragraph describing Http.Resilience RemoveAllResilienceHandlers method #45335
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
[Resilient HTTP apps] Add a paragraph describing Http.Resilience RemoveAllResilienceHandlers method #45335
Changes from 3 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
eddd643
Documentation for the Http.Resilience RemoveAllResilienceHandlers method
rainsxng af03af6
Fixing the build, resolving pr comments
rainsxng c960891
Silencing the warning for the experimental API
rainsxng b50e0f1
PR review fixes
rainsxng aa4d410
Merge branch 'main' into dbohdanov/http-resilience-remove-handlers
rainsxng be592e9
trying to pass the snippet build
rainsxng 19555cc
Include range to the code snippet
rainsxng 893ee54
use range instead of ids
rainsxng e419ecd
fix articles usage
rainsxng dc6ebc1
Grammar fixes
rainsxng 5a98112
Update docs/core/resilience/http-resilience.md
IEvangelist File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
docs/core/resilience/snippets/http-resilience/Program.RemoveHandlers.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using System.Net; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Microsoft.Extensions.Http.Resilience; | ||
using Polly; | ||
|
||
internal partial class Program | ||
{ | ||
private static void RemoveHandlers(IHttpClientBuilder httpClientBuilder) | ||
rainsxng marked this conversation as resolved.
Show resolved
Hide resolved
|
||
{ | ||
// <remove-handlers> | ||
var services = new ServiceCollection(); | ||
services.ConfigureHttpClientDefaults(builder => builder.AddStandardResilienceHandler()); | ||
rainsxng marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// For a named HttpClient "custom" we want to remove the StandardResilienceHandler and add the StandardHedgingHandler instead. | ||
rainsxng marked this conversation as resolved.
Show resolved
Hide resolved
|
||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Resilience", "EXTEXP0001:Experimental API")] | ||
Check failure on line 14 in docs/core/resilience/snippets/http-resilience/Program.RemoveHandlers.cs
|
||
rainsxng marked this conversation as resolved.
Show resolved
Hide resolved
|
||
services.AddHttpClient("custom") | ||
Check failure on line 15 in docs/core/resilience/snippets/http-resilience/Program.RemoveHandlers.cs
|
||
.RemoveAllResilienceHandlers() | ||
.AddStandardHedgingHandler(); | ||
// </remove-handlers> | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.