mirror of
https://github.com/bitwarden/ios.git
synced 2026-04-13 01:13:26 -05:00
22 lines
586 B
Swift
22 lines
586 B
Swift
import Networking
|
|
|
|
@MainActor
|
|
class TestResponseHandler: ResponseHandler {
|
|
var handledResponse: HTTPResponse?
|
|
var responseHandler: ((inout HTTPResponse) -> Void)?
|
|
|
|
init(_ responseHandler: ((inout HTTPResponse) -> Void)?) {
|
|
self.responseHandler = responseHandler
|
|
}
|
|
|
|
func handle(
|
|
_ response: inout HTTPResponse,
|
|
for request: HTTPRequest,
|
|
retryWith: ((HTTPRequest) async throws -> HTTPResponse)?,
|
|
) async throws -> HTTPResponse {
|
|
handledResponse = response
|
|
responseHandler?(&response)
|
|
return response
|
|
}
|
|
}
|