dev add violation notion
Test Workflow / test (push) Successful in 3s

This commit is contained in:
vladp
2026-03-20 16:43:11 +07:00
parent 97d6c8317e
commit 31aa1c0545
@@ -114,7 +114,12 @@ public class SearchImageService {
}
private String callReverseImageApiByUrl(String imageUrl, String engine, String searchType) throws IOException {
log.info("=== START SEARCH API CALL ===");
log.info("Engine: {}, SearchType: {}", engine, searchType);
log.info("ImageUrl: {}", imageUrl);
if (searchApiKey == null || searchApiKey.isBlank()) {
log.error("SearchAPI key not configured");
throw new IllegalStateException("SearchAPI key not configured");
}
@@ -129,6 +134,8 @@ public class SearchImageService {
.addQueryParameter("t_", String.valueOf(System.currentTimeMillis()))
.build();
log.info("Request URL: {}", url);
Request request = new Request.Builder()
.url(url)
.header("Accept", "application/json")
@@ -144,20 +151,25 @@ public class SearchImageService {
ResponseBody body = response.body();
if (body == null) {
log.error("Response body is null");
throw new IOException("Empty response body");
}
String responseBody = body.string();
log.info("responseBody: " + responseBody);
log.info("responseBody: " + responseBody);
log.info("responseBody: " + responseBody);
log.info("=== RESPONSE BODY LENGTH: {} ===", responseBody.length());
log.info("=== RESPONSE BODY START: {} ===",
responseBody.length() > 200 ? responseBody.substring(0, 200) : responseBody);
if (!response.isSuccessful()) {
log.error("Response not successful: {}", response.code());
throw new IOException("API error " + response.code() + ": " + responseBody);
}
return responseBody;
} catch (Exception e) {
log.error("Exception in search API call: {}", e.getMessage(), e);
throw e;
}
}