sendRaw method
Future<WebDriverResponse>
sendRaw( - WebDriverRequest request
)
Implementation
@override
Future<WebDriverResponse> sendRaw(WebDriverRequest request) async {
await _lock.acquire();
final headers = {
'Accept': 'application/json',
};
headers.addAll(_headers);
if (request.body != null && request.body!.isNotEmpty) {
headers['Content-Type'] ??= 'application/json';
}
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?,
);
}