MockHttpServletRequest allows for removing registered header values
Includes full alignment of spring-test vs spring-web mock variants. Issue: SPR-17295
This commit is contained in:
@@ -987,9 +987,9 @@ public class MockHttpServletRequest implements HttpServletRequest {
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a header entry for the given name.
|
||||
* <p>While this method can take any {@code Object} as a parameter, it
|
||||
* is recommended to use the following types:
|
||||
* Add an HTTP header entry for the given name.
|
||||
* <p>While this method can take any {@code Object} as a parameter,
|
||||
* it is recommended to use the following types:
|
||||
* <ul>
|
||||
* <li>String or any Object to be converted using {@code toString()}; see {@link #getHeader}.</li>
|
||||
* <li>String, Number, or Date for date headers; see {@link #getDateHeader}.</li>
|
||||
@@ -1041,6 +1041,15 @@ public class MockHttpServletRequest implements HttpServletRequest {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove already registered values for the specified HTTP header, if any.
|
||||
* @since 5.1.1
|
||||
*/
|
||||
public void removeHeader(String name) {
|
||||
Assert.notNull(name, "Header name must not be null");
|
||||
this.headers.remove(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the long timestamp for the date header with the given {@code name}.
|
||||
* <p>If the internal value representation is a String, this method will try
|
||||
|
||||
Reference in New Issue
Block a user