Starting with spring-web 6.1.2, the HttpHeaders supplied to RestClientResponseException are copied into a new LinkedMultiValueMap, that is not case-insensitive anymore. Headers from getResponseHeaders() can then no longer be found without the correct case.

public RestClientResponseException(
        String message, HttpStatusCode statusCode, String statusText, @Nullable HttpHeaders headers,
        @Nullable byte[] responseBody, @Nullable Charset responseCharset) {
    ...
    this.responseHeaders = copyHeaders(headers);
    ...
}

private static HttpHeaders copyHeaders(@Nullable HttpHeaders headers) {
    if (headers != null) {
        MultiValueMap<String, String> result = new LinkedMultiValueMap<>(headers.size());
        headers.forEach((name, values) -> values.forEach(value -> result.add(name, value)));
        return HttpHeaders.readOnlyHttpHeaders(result);
    }
    else {
        return null;
    }
}

Comment From: bclozel

See https://github.com/spring-projects/spring-framework/issues/31787