sendRaw method Null safety

  1. @override
Future<WebDriverResponse> sendRaw(
  1. WebDriverRequest request
)

Implementation

@override
Future<WebDriverResponse> sendRaw(WebDriverRequest request) async {
  await _lock.acquire();

  final headers = {
    'Accept': 'application/json',
  };

  headers.addAll(_headers);

  HttpRequest httpRequest;

  try {
    httpRequest = await HttpRequest.request(resolve(request.uri!).toString(),
        method: request.method!.name,
        requestHeaders: headers,
        sendData: request.body,
        mimeType: 'application/json');
  } on ProgressEvent catch (e) {
    httpRequest = e.target as HttpRequest;
  } finally {
    _lock.release();
  }

  return WebDriverResponse(
    httpRequest.status,
    httpRequest.statusText,
    httpRequest.response as String?,
  );
}