File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
web/src/test/java/org/springframework/security/web/servlet Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change 1717package org .springframework .security .web .servlet ;
1818
1919import java .util .LinkedHashMap ;
20+ import java .util .List ;
2021import java .util .Map ;
2122import java .util .function .Consumer ;
2223import java .util .regex .Matcher ;
2728import org .springframework .http .HttpMethod ;
2829import org .springframework .mock .web .MockHttpServletRequest ;
2930import org .springframework .util .StringUtils ;
31+ import org .springframework .web .util .UriComponentsBuilder ;
3032
3133public final class TestMockHttpServletRequests {
3234
@@ -149,6 +151,14 @@ public Builder serverName(String serverName) {
149151
150152 public MockHttpServletRequest build () {
151153 MockHttpServletRequest request = new MockHttpServletRequest ();
154+ Map <String , List <String >> params = UriComponentsBuilder .fromUriString ("?" + this .queryString )
155+ .build ()
156+ .getQueryParams ();
157+ for (Map .Entry <String , List <String >> entry : params .entrySet ()) {
158+ for (String value : entry .getValue ()) {
159+ request .addParameter (entry .getKey (), value );
160+ }
161+ }
152162 applyElement (request ::setContextPath , this .contextPath );
153163 applyElement (request ::setContextPath , this .contextPath );
154164 applyElement (request ::setMethod , this .method .name ());
You can’t perform that action at this time.
0 commit comments