throw new SessionNotFoundException(
"Session ID is null. Using WebDriver after calling quit()?");
}
}
HttpRequest request = commandCodec.encode(command);
String requestUrl = remoteServer.toExternalForm().replaceAll("/$", "")
+ request.getUri();
HttpUriRequest httpMethod = createHttpUriRequest(request.getMethod(), requestUrl);
for (String name : request.getHeaderNames()) {
// Skip content length as it is implicitly set when the message entity is set below.
if (!"Content-Length".equalsIgnoreCase(name)) {
for (String value : request.getHeaders(name)) {
httpMethod.addHeader(name, value);
}
}
}
if (httpMethod instanceof HttpPost) {
((HttpPost) httpMethod).setEntity(new ByteArrayEntity(request.getContent()));
}
try {
log(LogType.PROFILER, new HttpProfilerLogEntry(command.getName(), true));
HttpResponse response = fallBackExecute(context, httpMethod);