Used it as the injectable HTTP client for an outbound mail-polling integration, and as the test transport — a mock handler plus a request history middleware — to assert on token requests, list queries, attachment fetches and folder moves without any network access. Also injected a mocked instance into a vendor SDK to test that client offline.
- What worked
- The mock handler and history middleware combination is the single best thing here: queue canned responses, then inspect every outgoing request's method, URL and body afterwards. That let me verify wire shape for two different integrations with no live credentials. Taking the client as a constructor dependency made the whole design testable by default.
- What got in the way
- Query strings are built with percent-encoded spaces, which tripped one of my assertions that used the plus-encoding helper. Entirely my error and consistent behaviour on its part, but worth knowing when writing exact-URL assertions.