diff --git a/spring-web/src/main/java/org/springframework/http/server/reactive/ReactorNetty2ServerHttpRequest.java b/spring-web/src/main/java/org/springframework/http/server/reactive/ReactorNetty2ServerHttpRequest.java index ba76338d6040..699bcf483b22 100644 --- a/spring-web/src/main/java/org/springframework/http/server/reactive/ReactorNetty2ServerHttpRequest.java +++ b/spring-web/src/main/java/org/springframework/http/server/reactive/ReactorNetty2ServerHttpRequest.java @@ -63,6 +63,8 @@ class ReactorNetty2ServerHttpRequest extends AbstractServerHttpRequest { private final Netty5DataBufferFactory bufferFactory; + private final HttpMethod method; + public ReactorNetty2ServerHttpRequest(HttpServerRequest request, Netty5DataBufferFactory bufferFactory) throws URISyntaxException { @@ -71,6 +73,7 @@ public ReactorNetty2ServerHttpRequest(HttpServerRequest request, Netty5DataBuffe Assert.notNull(bufferFactory, "DataBufferFactory must not be null"); this.request = request; this.bufferFactory = bufferFactory; + this.method = HttpMethod.valueOf(request.method().name()); } private static URI initUri(HttpServerRequest request) throws URISyntaxException { @@ -141,7 +144,7 @@ private static String resolveRequestUri(HttpServerRequest request) { @Override public HttpMethod getMethod() { - return HttpMethod.valueOf(this.request.method().name()); + return this.method; } @Override diff --git a/spring-web/src/main/java/org/springframework/http/server/reactive/ReactorServerHttpRequest.java b/spring-web/src/main/java/org/springframework/http/server/reactive/ReactorServerHttpRequest.java index bcb76e7ab67d..2b79cfdafa64 100644 --- a/spring-web/src/main/java/org/springframework/http/server/reactive/ReactorServerHttpRequest.java +++ b/spring-web/src/main/java/org/springframework/http/server/reactive/ReactorServerHttpRequest.java @@ -61,6 +61,8 @@ class ReactorServerHttpRequest extends AbstractServerHttpRequest { private final NettyDataBufferFactory bufferFactory; + private final HttpMethod method; + public ReactorServerHttpRequest(HttpServerRequest request, NettyDataBufferFactory bufferFactory) throws URISyntaxException { @@ -69,6 +71,7 @@ public ReactorServerHttpRequest(HttpServerRequest request, NettyDataBufferFactor Assert.notNull(bufferFactory, "DataBufferFactory must not be null"); this.request = request; this.bufferFactory = bufferFactory; + this.method = HttpMethod.valueOf(request.method().name()); } private static URI initUri(HttpServerRequest request) throws URISyntaxException { @@ -111,7 +114,7 @@ private static String resolveRequestUri(HttpServerRequest request) { @Override public HttpMethod getMethod() { - return HttpMethod.valueOf(this.request.method().name()); + return this.method; } @Override