Sometimes multiple requests are only differentiated by the request body, as is often the case with GraphQL queries. When unit-testing code that makes such requests, we often want to provide a different response, depending on the request body OR a pattern within the body.
Currently, we can get close with something like this:
MockTransports.http.expect('GET', myUri, respondWith: myResponse);
Ideally, we could do something like this:
MockTransports.http.expect('GET', myUri, body: myBody, respondWith: myResponse);
Or,
`MockTransports.http.expectPattern('GET', myUriPattern, bodyPattern: myBodyPattern, respondWith: myResponse);
Sometimes multiple requests are only differentiated by the request body, as is often the case with GraphQL queries. When unit-testing code that makes such requests, we often want to provide a different response, depending on the request body OR a pattern within the body.
Currently, we can get close with something like this:
MockTransports.http.expect('GET', myUri, respondWith: myResponse);Ideally, we could do something like this:
MockTransports.http.expect('GET', myUri, body: myBody, respondWith: myResponse);Or,
`MockTransports.http.expectPattern('GET', myUriPattern, bodyPattern: myBodyPattern, respondWith: myResponse);