BSiLabs / HttpTracer

MIT License
172 stars 13 forks source link

Make a fluent builder class, to handle all custom HTTP Handlers that the client may have #2

Closed DanielCauser closed 6 years ago

DanielCauser commented 6 years ago

https://www.codeproject.com/Articles/640997/Fluent-interfaces-and-Method-Chaining-in-Csharp

ChaseFlorell commented 6 years ago

What do you foresee the API looking like for this? What's the purpose of a fluent API on this lib?

man, I always feel like my terse questions make me sound like an asshole, but I genuinely want to know.. if for no other reason than that I'd like to submit a PR

DanielCauser commented 6 years ago

Hahaha, I want to have this builder available, in case the user has other Custom Handlers of his own. We have to make sure that our HttpTracerHandler is the "Root" handler, and all other custom handlers, are chained in the InnerHandler of our Tracer handler.

The user would chain all of his Custom HTTPHandlers using our fluent Builder and when he the .Build method, we will chain all of it together and return it to the client, so he can add it in the constructor of his HttpClient instance.

ChaseFlorell commented 6 years ago

How does that work? What's the purpose of multiple handlers?

dylanberry commented 6 years ago

That doesn't work if one of the handlers is adding a gzip header/handler.

On Tue, Apr 10, 2018, 10:17 PM Chase Florell, notifications@github.com wrote:

How does that work? What's the purpose of multiple handlers?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/TorontoMobileDevelopers/HttpTracer/issues/2#issuecomment-380304747, or mute the thread https://github.com/notifications/unsubscribe-auth/ABwV_irJCzR6ql-3daURbFLd7VZeQiCDks5tnWfEgaJpZM4TNVSh .

DanielCauser commented 6 years ago

I thought that we could chain the httphandlers that users might have together, make sure our handler would be the root, so we would be sure that the user could have other handlers and also have ours. But after testing it out, it seems that I was wrong on how the handlers behave. @dylanberry is completely right. This will not work. I'm closing this issue o/

DanielCauser commented 6 years ago

aaaand we are bringing this back ahahaha.