failRequest

abstract fun failRequest(id: TransactionId, durationMs: Long, error: String)

Records a failed transaction id after durationMs, with the error description. After a response was reported, it records that the body failed while the app read it, and the response's status and headers are kept.


open fun failRequest(id: TransactionId, durationMs: Long, error: String, mockedBy: MockRule)

Records the transaction id as failed after durationMs, with the error description, because the mock rule mockedBy failed it: a rule with a MockRule.failure, as returned by findMockRule. The Network tab then says which rule failed the request, as CapturedResponse.Builder.mockedBy does for a rule that answered one.

The default implementation calls failRequest without the rule, so a sink written before this method keeps working.