Skip to content

Commit

Permalink
Add some logs for debbuging
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrunner committed Feb 13, 2024
1 parent 2947d4e commit 5c95d88
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,20 @@ private CachedClientHttpResponse(final ClientHttpResponse originalResponse) thro
this.statusText = originalResponse.getStatusText();
this.cachedFile =
File.createTempFile("cacheduri", null, HttpRequestFetcher.this.temporaryDirectory);
LOGGER.debug("Caching URI resource to {}", this.cachedFile);
try (OutputStream os = Files.newOutputStream(this.cachedFile.toPath())) {
IOUtils.copy(originalResponse.getBody(), os);
InputStream body = originalResponse.getBody();
LOGGER.debug("Get from input stream {}, for response {}", body.getClass(), originalResponse.getClass());
LOGGER.debug("Body available: {}", body.available());
IOUtils.copy(body, os);
}
}

@Override
@Nonnull
public InputStream getBody() throws IOException {
if (this.body == null) {
LOGGER.debug("Loading cached URI resource from {}", this.cachedFile);
this.body = new FileInputStream(this.cachedFile);
}
return this.body;
Expand Down

0 comments on commit 5c95d88

Please sign in to comment.