Skip to content

Commit

Permalink
Lukke entity
Browse files Browse the repository at this point in the history
  • Loading branch information
zapodot committed Oct 3, 2023
1 parent 33c1c90 commit da29f23
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ public SendtMeldingApiModel send(@NonNull MeldingSpesifikasjonApiModel metadata,
return client.execute(request, response -> {
final int responseCode = response.getCode();
log.debug("Response status: {}", responseCode);
try (InputStream content = response.getEntity().getContent() ) {
try (final HttpEntity entity = response.getEntity();
final InputStream content = entity.getContent()) {
if (responseCode >= HttpStatus.SC_BAD_REQUEST) {
final var contentAsString = IOUtils.toString(content, StandardCharsets.UTF_8);
throw new FiksIOHttpException(String.format("HTTP-feil under sending av melding (%d): %s", responseCode, contentAsString), responseCode, contentAsString);
Expand Down

0 comments on commit da29f23

Please sign in to comment.