Merge branch '6.2.x'
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Has been cancelled Details
Deploy Docs / Dispatch docs deployment (push) Has been cancelled Details
Build and Deploy Snapshot / Verify (push) Has been cancelled Details

This commit is contained in:
Sam Brannen 2025-05-22 17:44:03 +02:00
commit 6653cd86ea
1 changed files with 3 additions and 1 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2024 the original author or authors.
* Copyright 2002-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -19,6 +19,7 @@ package org.springframework.http.client;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.util.Objects;
import org.jspecify.annotations.Nullable;
@ -102,6 +103,7 @@ final class SimpleClientHttpResponse implements ClientHttpResponse {
if (this.responseStream == null) {
getBody();
}
Objects.requireNonNull(this.responseStream);
StreamUtils.drain(this.responseStream);
this.responseStream.close();
}