Skip to content

Commit 900f2ee

Browse files
algolia-botmillotp
andcommitted
fix(cts): add tests for HTML error (generated)
algolia/api-clients-automation#4097 Co-authored-by: algolia-bot <[email protected]> Co-authored-by: Pierre Millot <[email protected]>
1 parent 33c4f23 commit 900f2ee

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

algoliasearch/src/main/java/com/algolia/internal/interceptors/RetryStrategy.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@ private Response handleResponse(StatefulHost host, @Nonnull Response response) t
8484

8585
try {
8686
String message = response.body() != null ? response.body().string() : response.message();
87+
if (response.header("Content-Type", "application/json").contains("text/html")) {
88+
message = response.message();
89+
}
8790
throw isRetryable(response)
8891
? new AlgoliaRequestException(message, response.code())
8992
: new AlgoliaApiException(message, response.code());

0 commit comments

Comments
 (0)