Interfaces 101 : Parsing Command Flags Ep. 9

1 · · March 27, 2023, 7:46 p.m.
Introduction In episode 8, Miki developed a Go HTTP client that had a method to check the health of a theoretical API. The method would construct the request URL and return an error based on the response code received from the server. Miki then created a type that would mock Go’s http.RoundTripper interface and replace his client’s transport with said type to test it. To improve the efficacy, Miki’s stub will simulate an erroneous response to see if his client’s Health method is working as inten...