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:
Arjen Poutsma
2017-05-24 16:36:58 +02:00
parent 31d1e26c95
commit 630fc194f0
26 changed files with 111 additions and 42 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2017 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.
@@ -66,6 +66,11 @@ public class MockClientHttpRequest extends MockHttpOutputMessage implements Clie
return this.httpMethod;
}
@Override
public String getMethodValue() {
return this.httpMethod.name();
}
public void setURI(URI uri) {
this.uri = uri;
}

View File

@@ -83,6 +83,11 @@ public class MockServerHttpRequest extends AbstractServerHttpRequest {
return this.httpMethod;
}
@Override
public String getMethodValue() {
return this.httpMethod.name();
}
@Override
public String getContextPath() {
return this.contextPath;