Add HttpRequest.getMethodValue
This commit introduces a new method in HttpRequest: `String getMethodValue`, which returns the HTTP method as a String. Furthermore, HttpRequest.getMethod() has been given a default implementation using this String value in combination with `HttpMethod.resolve`. Issue: SPR-15545
This commit is contained in:
@@ -267,6 +267,11 @@ public class InterceptingClientHttpRequestFactoryTests {
|
||||
return method;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMethodValue() {
|
||||
return method.name();
|
||||
}
|
||||
|
||||
public void setMethod(HttpMethod method) {
|
||||
this.method = method;
|
||||
}
|
||||
|
||||
@@ -31,7 +31,6 @@ import org.springframework.core.io.buffer.DataBuffer;
|
||||
import org.springframework.core.io.buffer.NettyDataBufferFactory;
|
||||
import org.springframework.http.HttpCookie;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.LinkedMultiValueMap;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
@@ -93,8 +92,8 @@ public class RxNettyServerHttpRequest extends AbstractServerHttpRequest {
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpMethod getMethod() {
|
||||
return HttpMethod.valueOf(this.request.getHttpMethod().name());
|
||||
public String getMethodValue() {
|
||||
return this.request.getHttpMethod().name();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -82,6 +82,11 @@ public class MockServerHttpRequest extends AbstractServerHttpRequest {
|
||||
return this.httpMethod;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMethodValue() {
|
||||
return this.httpMethod.name();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getContextPath() {
|
||||
return this.contextPath;
|
||||
|
||||
Reference in New Issue
Block a user