replySequence method
Answers matching requests with each of responses in turn, repeating
the last one once exhausted. Handy for retry and polling tests.
Implementation
void replySequence(
String method,
Pattern path,
List<MockResponse> responses,
) {
assert(responses.isNotEmpty, 'responses must not be empty');
var index = 0;
on(method, path, (_) {
final response = responses[index];
if (index < responses.length - 1) {
index++;
}
return response;
});
}