carsdotcom / php-request-class

Structure the logic around Guzzle API requests into object-oriented classes
MIT License
2 stars 1 forks source link

feat: A request can choose to ignore dependency injection for the Guzzle Client #12

Closed jwadhams closed 3 months ago

jwadhams commented 3 months ago

I'm introducing this change because we have dozens and dozens of APIs that use request classes, but right now we have one new set of requests that have to interoperate as if they're live, but still return mocked data.

Adding this capability to the request classes seemed like smart encapsulation, all the surrounding code can act as if the requests are really using the network. And re-using Tapper is firmly within our wheelhouse -- that seems like it leaves the door open for really feature rich mocks like using addMatch with a lambda that reads and reacts to the request body.