File tree 1 file changed +18
-1
lines changed
spring-cloud-gateway-server-mvc/src/test/java/org/springframework/cloud/gateway/server/mvc/filter
1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -132,19 +132,36 @@ void rewriteEncodedRequestParameter() {
132
132
.hasToString ("http://localhost/path?quux=corge%2B&baz=qux&foo%5B%5D=replacement%5B%5D" );
133
133
}
134
134
135
+ @ Test
136
+ void rewritePlusSignRequestParameter () {
137
+ MockHttpServletRequest servletRequest = MockMvcRequestBuilders .get ("http://localhost/path" )
138
+ .param ("foo" , "bar" )
139
+ .param ("baz" , "qux" )
140
+ .buildRequest (null );
141
+
142
+ ServerRequest request = ServerRequest .create (servletRequest , Collections .emptyList ());
143
+
144
+ ServerRequest result = BeforeFilterFunctions .rewriteRequestParameter ("foo" , "replacement+" ).apply (request );
145
+
146
+ assertThat (result .param ("foo" )).isPresent ().hasValue ("replacement+" );
147
+ assertThat (result .uri ().toString ()).hasToString ("http://localhost/path?baz=qux&foo=replacement%2B" );
148
+ }
149
+
135
150
@ Test
136
151
void rewriteRequestParameterWithEncodedRemainParameters () {
137
152
MockHttpServletRequest servletRequest = MockMvcRequestBuilders .get ("http://localhost/path" )
138
153
.param ("foo" , "bar" )
139
154
.param ("baz[]" , "qux[]" )
155
+ .param ("quux" , "corge+" )
140
156
.buildRequest (null );
141
157
142
158
ServerRequest request = ServerRequest .create (servletRequest , Collections .emptyList ());
143
159
144
160
ServerRequest result = BeforeFilterFunctions .rewriteRequestParameter ("foo" , "replacement" ).apply (request );
145
161
146
162
assertThat (result .param ("foo" )).isPresent ().hasValue ("replacement" );
147
- assertThat (result .uri ().toString ()).hasToString ("http://localhost/path?baz%5B%5D=qux%5B%5D&foo=replacement" );
163
+ assertThat (result .uri ().toString ())
164
+ .hasToString ("http://localhost/path?baz%5B%5D=qux%5B%5D&quux=corge%2B&foo=replacement" );
148
165
}
149
166
150
167
@ Test
You can’t perform that action at this time.
0 commit comments