Support HTTP HEAD method in MockMvcRequestBuilders
Surprisingly until now the MockMvcRequestBuilders did not have methods for HTTP HEAD. This change adds such methods to the API making it consistent with other HTTP method types. Issue: SPR-12055
This commit is contained in:
parent
fe88b6e054
commit
a11b62540a
|
@ -146,6 +146,25 @@ public abstract class MockMvcRequestBuilders {
|
|||
return new MockHttpServletRequestBuilder(HttpMethod.OPTIONS, uri);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a {@link MockHttpServletRequestBuilder} for a HEAD request.
|
||||
* @param urlTemplate a URL template; the resulting URL will be encoded
|
||||
* @param urlVariables zero or more URL variables
|
||||
* @since 4.1
|
||||
*/
|
||||
public static MockHttpServletRequestBuilder head(String urlTemplate, Object... urlVariables) {
|
||||
return new MockHttpServletRequestBuilder(HttpMethod.HEAD, urlTemplate, urlVariables);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a {@link MockHttpServletRequestBuilder} for a HEAD request.
|
||||
* @param uri the URL
|
||||
* @since 4.1
|
||||
*/
|
||||
public static MockHttpServletRequestBuilder head(URI uri) {
|
||||
return new MockHttpServletRequestBuilder(HttpMethod.HEAD, uri);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a {@link MockHttpServletRequestBuilder} for a request with the given HTTP method.
|
||||
* @param httpMethod the HTTP method
|
||||
|
|
Loading…
Reference in New Issue