@@ -102,7 +102,7 @@ public class MockHttpServletRequest implements HttpServletRequest {
102
102
new BufferedReader (new StringReader ("" ));
103
103
104
104
/**
105
- * Date formats as specified in the HTTP RFC
105
+ * Date formats as specified in the HTTP RFC.
106
106
* @see <a href="https://tools.ietf.org/html/rfc7231#section-7.1.1.1">Section 7.1.1.1 of RFC 7231</a>
107
107
*/
108
108
private static final String [] DATE_FORMATS = new String [] {
@@ -569,7 +569,7 @@ public void addParameter(String name, String... values) {
569
569
}
570
570
571
571
/**
572
- * Adds all provided parameters <strong>without</strong> replacing any
572
+ * Add all provided parameters <strong>without</strong> replacing any
573
573
* existing values. To replace existing values, use
574
574
* {@link #setParameters(java.util.Map)}.
575
575
*/
@@ -598,7 +598,7 @@ public void removeParameter(String name) {
598
598
}
599
599
600
600
/**
601
- * Removes all existing parameters.
601
+ * Remove all existing parameters.
602
602
*/
603
603
public void removeAllParameters () {
604
604
this .parameters .clear ();
@@ -764,8 +764,8 @@ public void addPreferredLocale(Locale locale) {
764
764
/**
765
765
* Set the list of preferred locales, in descending order, effectively replacing
766
766
* any existing locales.
767
- * @see #addPreferredLocale
768
767
* @since 3.2
768
+ * @see #addPreferredLocale
769
769
*/
770
770
public void setPreferredLocales (List <Locale > locales ) {
771
771
Assert .notEmpty (locales , "Locale list must not be empty" );
@@ -966,9 +966,9 @@ public Cookie[] getCookies() {
966
966
}
967
967
968
968
/**
969
- * Add a header entry for the given name.
970
- * <p>While this method can take any {@code Object} as a parameter, it
971
- * is recommended to use the following types:
969
+ * Add an HTTP header entry for the given name.
970
+ * <p>While this method can take any {@code Object} as a parameter,
971
+ * it is recommended to use the following types:
972
972
* <ul>
973
973
* <li>String or any Object to be converted using {@code toString()}; see {@link #getHeader}.</li>
974
974
* <li>String, Number, or Date for date headers; see {@link #getDateHeader}.</li>
@@ -1020,6 +1020,15 @@ else if (value.getClass().isArray()) {
1020
1020
}
1021
1021
}
1022
1022
1023
+ /**
1024
+ * Remove already registered entries for the specified HTTP header, if any.
1025
+ * @since 4.3.20
1026
+ */
1027
+ public void removeHeader (String name ) {
1028
+ Assert .notNull (name , "Header name must not be null" );
1029
+ this .headers .remove (name );
1030
+ }
1031
+
1023
1032
/**
1024
1033
* Return the long timestamp for the date header with the given {@code name}.
1025
1034
* <p>If the internal value representation is a String, this method will try
@@ -1264,7 +1273,7 @@ public HttpSession getSession() {
1264
1273
public String changeSessionId () {
1265
1274
Assert .isTrue (this .session != null , "The request does not have a session" );
1266
1275
if (this .session instanceof MockHttpSession ) {
1267
- return ((MockHttpSession ) session ).changeSessionId ();
1276
+ return ((MockHttpSession ) this . session ).changeSessionId ();
1268
1277
}
1269
1278
return this .session .getId ();
1270
1279
}
0 commit comments