remotemobprogramming / mob

Tool for smooth git handover.
https://mob.sh
MIT License
1.68k stars 150 forks source link

Refactoring usages of http.client #454

Open Alex-CD opened 1 month ago

Alex-CD commented 1 month ago

Hey :)

So a few places depend on Go's built-in http.client directly, or indirectly (through httpclient.go). My thought was that it could be an improvement to work towards injecting http.client as a dependency - this would decouple several functions away from it, improving their testability.

As an initial first step, I could make a change that:

Of course, usages http.SendRequest would still depend indirectly on http.client ( via httpClient.GetHttpClient), but this would get us a foot in the door regarding doing more dependency injection elsewhere. I've seen some other issues that discuss how heavily coupled some functions are, and I believe dependency injection could help us improve some of those tight coupling problems

This would be my first open source contribution in a while, and my first Go work in a few years, so your thoughts are especially welcome here :)

My team have also been making heavy use of this tool for a while and it's been really helpful, so thank you! :heart:

gregorriegler commented 1 month ago

I like the Idea! Can you PR an example so i got the full picture?

Alex-CD commented 1 month ago

Will get one with you soon!

Alex-CD commented 1 month ago

https://github.com/remotemobprogramming/mob/pull/457