kinwahlai/YetAnotherHTTPStub

I want to put a delay to the StubResponse, a delay before reply to the request

Closed this issue · 1 comments

I want to put a delay to the StubResponse that delay the reply to the request.
Maybe this can be useful to mimic some network condition or timeout.

Maybe the code can be like this:

YetAnotherURLProtocol.stubHTTP { (session) in
    session.whenRequest(matcher: http(.get, uri: "/get"))
                 .thenResponse(withDelay: 5, responseBuilder: jsonData(data, status: 200))
}