|
51 | 51 | import static org.openqa.selenium.remote.tracing.Tags.HTTP_REQUEST; |
52 | 52 | import static org.openqa.selenium.remote.tracing.Tags.HTTP_REQUEST_EVENT; |
53 | 53 | import static org.openqa.selenium.remote.tracing.Tags.HTTP_RESPONSE; |
54 | | -import static org.openqa.selenium.remote.tracing.Tags.HTTP_RESPONSE_EVENT; |
55 | 54 |
|
56 | 55 | class HandleSession implements HttpHandler { |
57 | 56 |
|
@@ -84,15 +83,15 @@ public HttpResponse execute(HttpRequest req) { |
84 | 83 | HTTP_REQUEST_EVENT.accept(attributeMap, req); |
85 | 84 |
|
86 | 85 | SessionId id = getSessionId(req.getUri()).map(SessionId::new) |
87 | | - .orElseThrow(() -> { |
88 | | - NoSuchSessionException exception = new NoSuchSessionException("Cannot find session: " + req); |
89 | | - EXCEPTION.accept(attributeMap, exception); |
90 | | - attributeMap.put(AttributeKey.EXCEPTION_MESSAGE.getKey(), |
91 | | - EventAttribute.setValue( |
92 | | - "Unable to execute request for an existing session: " + exception.getMessage())); |
93 | | - span.addEvent(AttributeKey.EXCEPTION_EVENT.getKey(), attributeMap); |
94 | | - return exception; |
95 | | - }); |
| 86 | + .orElseThrow(() -> { |
| 87 | + NoSuchSessionException exception = new NoSuchSessionException("Cannot find session: " + req); |
| 88 | + EXCEPTION.accept(attributeMap, exception); |
| 89 | + attributeMap.put(AttributeKey.EXCEPTION_MESSAGE.getKey(), |
| 90 | + EventAttribute.setValue( |
| 91 | + "Unable to execute request for an existing session: " + exception.getMessage())); |
| 92 | + span.addEvent(AttributeKey.EXCEPTION_EVENT.getKey(), attributeMap); |
| 93 | + return exception; |
| 94 | + }); |
96 | 95 |
|
97 | 96 | SESSION_ID.accept(span, id); |
98 | 97 | SESSION_ID_EVENT.accept(attributeMap, id); |
@@ -126,11 +125,8 @@ private Callable<HttpHandler> loadSessionId(Tracer tracer, Span span, SessionId |
126 | 125 | return span.wrap( |
127 | 126 | () -> { |
128 | 127 | Session session = sessions.get(id); |
129 | | - if (session instanceof HttpHandler) { |
130 | | - return (HttpHandler) session; |
131 | | - } |
132 | | - HttpClient client = httpClientFactory.createClient(Urls.fromUri(session.getUri())); |
133 | | - return new ReverseProxyHandler(tracer, client); |
| 128 | + HttpClient client = httpClientFactory.createClient(Urls.fromUri(session.getUri())); |
| 129 | + return new ReverseProxyHandler(tracer, client); |
134 | 130 | } |
135 | 131 | ); |
136 | 132 | } |
|
0 commit comments