File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed
main/java/org/springframework/http/server/reactive
test/java/org/springframework/http/server/reactive Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -72,7 +72,9 @@ public DefaultServerHttpRequestBuilder(ServerHttpRequest original) {
72
72
73
73
this .uri = original .getURI ();
74
74
// original headers can be immutable, so create a copy
75
- this .headers = new HttpHeaders (new LinkedMultiValueMap <>(original .getHeaders ()));
75
+ this .headers = new HttpHeaders ();
76
+ this .headers .putAll (original .getHeaders ());
77
+
76
78
this .httpMethod = original .getMethod ();
77
79
this .contextPath = original .getPath ().contextPath ().value ();
78
80
this .remoteAddress = original .getRemoteAddress ();
Original file line number Diff line number Diff line change @@ -212,6 +212,13 @@ public void mutateDoesNotPreventAccessToNativeRequest() throws Exception {
212
212
assertThat (nativeRequest ).isInstanceOf (HttpServletRequest .class );
213
213
}
214
214
215
+ @ Test // gh-33666
216
+ public void mutateKeepsHeadersCaseInsensitive () throws Exception {
217
+ ServerHttpRequest request = createRequest ("/path" );
218
+ request = request .mutate ().header ("key" , "value" ).build ();
219
+ assertThat (request .getHeaders ().get ("KEY" )).isEqualTo (Collections .singletonList ("value" ));
220
+ }
221
+
215
222
private ServerHttpRequest createRequest (String uriString ) throws Exception {
216
223
return createRequest (uriString , "" );
217
224
}
You can’t perform that action at this time.
0 commit comments