ok2c commented on code in PR #802:
URL:
https://github.com/apache/httpcomponents-client/pull/802#discussion_r2807277738
##########
httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestClientAuthentication.java:
##########
@@ -400,10 +408,11 @@ void
testBasicAuthenticationCredentialsCachingByPathPrefix() throws Exception {
}
// There should be an auth strategy call for all successful message
exchanges
- Mockito.verify(authStrategy, Mockito.times(2)).select(Mockito.any(),
Mockito.any(), Mockito.any());
+ Mockito.verify(authStrategy, Mockito.times(3)).select(Mockito.any(),
Mockito.any(), Mockito.any());
- Assertions.assertEquals(Arrays.asList(200, 401, 200, 200, 401, 200),
-
responseQueue.stream().map(HttpResponse::getCode).collect(Collectors.toList()));
+ assertThat(
+
responseQueue.stream().map(HttpResponse::getCode).collect(Collectors.toList()),
+ CoreMatchers.equalTo(Arrays.asList(200, 401, 200, 401, 200,
401, 200)));
Review Comment:
@arturobernalg I see. My test case was wrong from the very beginning. The
path prefixes of the first and the third requests are different. I overlooked
it. Your fix is correct. Please just remove unnecessary code at line 166 in
`ProtocolExec` and line 162 in `AsyncProtocolExec`
```
if (targetAuthExchange.getPathPrefix() == null) {
targetAuthExchange.setPathPrefix(pathPrefix);
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]