From 57cb8c7abfb4458297e3d4fa6130b43da89f28ec Mon Sep 17 00:00:00 2001 From: rstoyanchev Date: Wed, 28 Aug 2024 18:12:26 +0300 Subject: [PATCH] Restore rawStatusCode methods Revert methods removed in 7df2e2a8d2a845984cde806232181da486dcf7bd. See gh-33440 --- .../test/web/reactive/server/ExchangeResult.java | 12 +++++++++++- .../http/client/reactive/ClientHttpResponse.java | 14 +++++++++++++- .../reactive/function/client/ClientResponse.java | 13 ++++++++++++- 3 files changed, 36 insertions(+), 3 deletions(-) diff --git a/spring-test/src/main/java/org/springframework/test/web/reactive/server/ExchangeResult.java b/spring-test/src/main/java/org/springframework/test/web/reactive/server/ExchangeResult.java index 6da41a7aba..4bfc054999 100644 --- a/spring-test/src/main/java/org/springframework/test/web/reactive/server/ExchangeResult.java +++ b/spring-test/src/main/java/org/springframework/test/web/reactive/server/ExchangeResult.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2023 the original author or authors. + * Copyright 2002-2024 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. @@ -176,6 +176,16 @@ public class ExchangeResult { return this.response.getStatusCode(); } + /** + * Return the HTTP status code as an integer. + * @since 5.1.10 + * @deprecated as of 6.0, in favor of {@link #getStatus()} + */ + @Deprecated(since = "6.0", forRemoval = true) + public int getRawStatusCode() { + return getStatus().value(); + } + /** * Return the response headers received from the server. */ diff --git a/spring-web/src/main/java/org/springframework/http/client/reactive/ClientHttpResponse.java b/spring-web/src/main/java/org/springframework/http/client/reactive/ClientHttpResponse.java index f4c022e8be..fcb08cf4be 100644 --- a/spring-web/src/main/java/org/springframework/http/client/reactive/ClientHttpResponse.java +++ b/spring-web/src/main/java/org/springframework/http/client/reactive/ClientHttpResponse.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2023 the original author or authors. + * Copyright 2002-2024 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. @@ -46,6 +46,18 @@ public interface ClientHttpResponse extends ReactiveHttpInputMessage { */ HttpStatusCode getStatusCode(); + /** + * Return the HTTP status code as an integer. + * @return the HTTP status as an integer value + * @since 5.0.6 + * @see #getStatusCode() + * @deprecated as of 6.0, in favor of {@link #getStatusCode()} + */ + @Deprecated(since = "6.0", forRemoval = true) + default int getRawStatusCode() { + return getStatusCode().value(); + } + /** * Return a read-only map of response cookies received from the server. */ diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/function/client/ClientResponse.java b/spring-webflux/src/main/java/org/springframework/web/reactive/function/client/ClientResponse.java index f5ca0ef240..3a238bad74 100644 --- a/spring-webflux/src/main/java/org/springframework/web/reactive/function/client/ClientResponse.java +++ b/spring-webflux/src/main/java/org/springframework/web/reactive/function/client/ClientResponse.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2023 the original author or authors. + * Copyright 2002-2024 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. @@ -57,6 +57,17 @@ public interface ClientResponse { */ HttpStatusCode statusCode(); + /** + * Return the raw status code of this response. + * @return the HTTP status as an integer value + * @since 5.1 + * @deprecated as of 6.0, in favor of {@link #statusCode()} + */ + @Deprecated(since = "6.0", forRemoval = true) + default int rawStatusCode() { + return statusCode().value(); + } + /** * Return the headers of this response. */