diff options
Diffstat (limited to 'core/src/main/scala/com/softwaremill/sttp/testing/SttpBackendStub.scala')
-rw-r--r-- | core/src/main/scala/com/softwaremill/sttp/testing/SttpBackendStub.scala | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/core/src/main/scala/com/softwaremill/sttp/testing/SttpBackendStub.scala b/core/src/main/scala/com/softwaremill/sttp/testing/SttpBackendStub.scala index d7d1034..d6119a9 100644 --- a/core/src/main/scala/com/softwaremill/sttp/testing/SttpBackendStub.scala +++ b/core/src/main/scala/com/softwaremill/sttp/testing/SttpBackendStub.scala @@ -107,6 +107,12 @@ class SttpBackendStub[R[_], S] private (rm: MonadError[R], } new SttpBackendStub(rm, matchers.orElse(m), fallback) } + def thenRespondWrapped(resp: Request[_, _] => R[Response[_]]): SttpBackendStub[R, S] = { + val m: PartialFunction[Request[_, _], R[Response[_]]] = { + case r if p(r) => resp(r) + } + new SttpBackendStub(rm, matchers.orElse(m), fallback) + } } } |