rPraml commented on code in PR #802:
URL:
https://github.com/apache/httpcomponents-client/pull/802#discussion_r2813224815
##########
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:
Interesting fact: As far as I understand, if I alternate between two paths
(e.g., '/blah/a', '/yada/a', '/blah/b', '/yada/', '/blah/c'), I receive a 401
error between each request because the prefix changes each time.
Just an idea:
Instead of remembering only the last prefix, one could keep a list of cached
prefixes. However, this raises the question of how to determine which entries
to include and when to evict them, as the list should be size-constrained."
(but I'm totally fine with the current fix)
--
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]