Skip to content

Commit fa4f0a0

Browse files
Apply suggestions from code review
Co-authored-by: Darius Letterman <[email protected]>
1 parent 28e8077 commit fa4f0a0

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

docs/core/resilience/http-resilience.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,13 @@ Additionally, these strategies handle the following exceptions:
102102
- `HttpRequestException`
103103
- `TimeoutRejectedException`
104104

105-
#### Disabling retries for a given list of HTTP methods
105+
#### Disable retries for a given list of HTTP methods
106106

107-
By default, the standard resilience handler is configured to make retries for all HTTP methods. For some applications such behavior could be undesirable or even harmful. For example, if a POST request inserts a new record to a database, then making retries for such a request could lead to data duplication. If you need to disable retries for a given list of HTTP methods you can use a method <xref:Microsoft.Extensions.Http.Resilience.HttpRetryStrategyOptionsExtensions.DisableFor> for that:
107+
By default, the standard resilience handler is configured to make retries for all HTTP methods. For some applications, such behavior could be undesirable or even harmful. For example, if a POST request inserts a new record to a database, then making retries for such a request could lead to data duplication. If you need to disable retries for a given list of HTTP methods you can use the <xref:Microsoft.Extensions.Http.Resilience.HttpRetryStrategyOptionsExtensions.DisableFor> method:
108108

109109
:::code language="csharp" source="snippets/http-resilience/Program.RetryOptions.cs" id="disable_for":::
110110

111-
Alternatively, you can use a method <xref:Microsoft.Extensions.Http.Resilience.HttpRetryStrategyOptionsExtensions.DisableForUnsafeHttpMethods> which disables retries for `POST`, `PATCH`, `PUT`, `DELETE`, and `CONNECT` HTTP methods. According to [RFC](https://www.rfc-editor.org/rfc/rfc7231#section-4.2.1) these methods are considered unsafe meaning their semantics is non readonly:
111+
Alternatively, you can use the <xref:Microsoft.Extensions.Http.Resilience.HttpRetryStrategyOptionsExtensions.DisableForUnsafeHttpMethods> method, which disables retries for `POST`, `PATCH`, `PUT`, `DELETE`, and `CONNECT` requests. According to [RFC](https://www.rfc-editor.org/rfc/rfc7231#section-4.2.1), these methods are considered unsafe; meaning their semantics are not read-only:
112112

113113
:::code language="csharp" source="snippets/http-resilience/Program.RetryOptions.cs" id="disable_for_unsafe_http_methods":::
114114

0 commit comments

Comments
 (0)