Open someniatko opened 1 year ago
Hello. You can use PockBuilder::replyWithCallback
method. The callback will receive two arguments: RequestInterface
and PockResponseBuilder
. You can safely ignore those and just return any ResponseInterface
implementation.
Thank you! This is a bit verbose and I would prefer to just pass a response directly (maybe internally PockBuilder
could call this replaceWithCallback()
method though), but this works as well.
First of all, this library is exactly what I was looking for, and I have found nothing comparable to it (
php-http/mock-client
lib is dated and also very barebones in comparison to this one), thank you!For now the intended way of crafting a response is to use the library's
PockResponseBuilder
. However, I'd like to just put my own response implementing PSR'sResponseInterface
, like that: