Skip to content

Instantly share code, notes, and snippets.

View alexssantos's full-sized avatar
🎇
lets make magic

Alex Santos alexssantos

🎇
lets make magic
View GitHub Profile
@alexssantos
alexssantos / GetInnerTimeoutFromHandlerRecursively.cs
Created February 15, 2023 23:55
Obtendo um DelegatingHandler do tipo TimeoutHandler de um HttpClient.
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;