Update code due to change in nullability contract

See gh-34933
This commit is contained in:
Sam Brannen
2025-05-22 17:43:38 +02:00
parent db5809f968
commit e4b4512bcb

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.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatusCode;
@@ -103,6 +104,7 @@ final class SimpleClientHttpResponse implements ClientHttpResponse {
if (this.responseStream == null) {
getBody();
}
Objects.requireNonNull(this.responseStream);
StreamUtils.drain(this.responseStream);
this.responseStream.close();
}