replay method
Sends request. Completes when the response or the error was received.
Implementation
@override
Future<void> replay(NetLensReplayRequest request) async {
final http.Client client = replayClient ?? http.Client();
// Files which are sent; the content of the new call can be read again.
final List<NetLensFormDataFile> files = [
for (final NetLensFormDataFile file in request.formDataFiles)
if (file.canRead) file,
];
try {
final http.BaseRequest httpRequest = request.isFormData
? _buildMultipartRequest(request, files)
: _buildRequest(request);
final http.Response response = await http.Response.fromStream(
await client.send(httpRequest),
);
_onResponse(response, files: files);
} finally {
if (replayClient == null) {
client.close();
}
}
}