@@ -343,20 +343,25 @@ public void setEncodingType(final FormEncodingType encodingType) {
343343 }
344344
345345 /**
346- * Retrieves the request parameters used. Similar to the servlet api function
346+ * <p> Retrieves the request parameters used. Similar to the servlet api function
347347 * getParameterMap() this works depending on the request type and collects the
348- * url parameters and the body stuff.
349- * The value is also normalized - null is converted to an empty string.
350- * In contrast to the servlet api this creates a separate KeyValuePair for every
348+ * url parameters and the body stuff.<br>
349+ * The value is also normalized - null is converted to an empty string.</p>
350+ * <p> In contrast to the servlet api this creates a separate KeyValuePair for every
351351 * parameter. This means that pairs with the same name can be part of the list. The
352- * servlet api will return a string[] as value for the key in this case.
352+ * servlet api will return a string[] as value for the key in this case.<br>
353+ * Additionally this method includes also the uploaded files for multipart post
354+ * requests.</p>
353355 *
354356 * @return the request parameters to use
355357 */
356358 public List <NameValuePair > getParameters () {
357359 // developer note:
358- // this has to be in sync with
359- // org.htmlunit.HttpWebConnection.makeHttpMethod(WebRequest, HttpClientBuilder)
360+ // this has to be in sync with org.htmlunit.HttpWebConnection.makeHttpMethod(WebRequest, HttpClientBuilder)
361+
362+ // developer note:
363+ // the spring org.springframework.test.web.servlet.htmlunitHtmlUnitRequestBuilder uses
364+ // this method and is sensitive to all the details of the current implementation.
360365
361366 if (HttpMethod .POST != getHttpMethod () && HttpMethod .PUT != getHttpMethod ()
362367 && HttpMethod .PATCH != getHttpMethod ()) {
@@ -402,9 +407,11 @@ public List<NameValuePair> getParameters() {
402407
403408 if (FormEncodingType .MULTIPART == getEncodingType ()) {
404409 final List <NameValuePair > allParameters = new ArrayList <>();
410+
411+ // the servlet api ignores these parameters but to make spring happy we include them
412+ allParameters .addAll (getRequestParameters ());
413+
405414 allParameters .addAll (HttpUtils .parseUrlQuery (getUrl ().getQuery (), getCharset ()));
406- // the servlet api ignores the parameters
407- // allParameters.addAll(getRequestParameters());
408415 return normalize (allParameters );
409416 }
410417
0 commit comments