Created
February 15, 2023 23:55
-
-
Save alexssantos/ac9cfa443bacac8ab8fd301e44cdc5d5 to your computer and use it in GitHub Desktop.
Obtendo um DelegatingHandler do tipo TimeoutHandler de um HttpClient.
This file contains 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
private TimeoutHandler GetInnerTimeoutFromHandlerRecursivelyFrom(HttpClient client) | |
{ | |
DelegatingHandler handlerIx = client | |
.GetType().BaseType | |
.GetField("_handler", BindingFlags.NonPublic | BindingFlags.Instance) | |
.GetValue(client) as DelegatingHandler; | |
while (handlerIx != null && handlerIx.GetType() != typeof(TimeoutHandler)) | |
{ | |
handlerIx = (DelegatingHandler)handlerIx.InnerHandler; | |
} | |
return (TimeoutHandler)handlerIx; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Obtendo um DelegatingHandler do tipo TimeoutHandler de um HttpClient.