Skip to content

Commit

Permalink
edit comment
Browse files Browse the repository at this point in the history
Signed-off-by: Sean Kao <[email protected]>
  • Loading branch information
seankao-az committed Dec 5, 2024
1 parent bd43c66 commit b04e1cd
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,14 @@ public boolean test(T result) throws Throwable {
return false;
}

// Buffer the entity to make it repeatable
// Buffer the entity to make it repeatable, so that this retry test does not consume the content stream,
// resulting in the request caller getting empty response
BufferedHttpEntity bufferedEntity = new BufferedHttpEntity(entity);
response.setEntity(bufferedEntity);

try {
String responseContent = EntityUtils.toString(bufferedEntity);
// Effectively restores the content stream of the response
bufferedEntity.getContent().reset();

boolean isRetryable = responseContent.contains(RESOURCE_ALREADY_EXISTS_EXCEPTION_MESSAGE);
Expand Down

0 comments on commit b04e1cd

Please sign in to comment.