File tree 2 files changed +10
-1
lines changed
main/java/org/springframework/http
test/java/org/springframework/http
2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -1136,7 +1136,7 @@ public void setHost(@Nullable InetSocketAddress host) {
1136
1136
set (HOST , value );
1137
1137
}
1138
1138
else {
1139
- remove (HOST , null );
1139
+ remove (HOST );
1140
1140
}
1141
1141
}
1142
1142
Original file line number Diff line number Diff line change @@ -213,6 +213,15 @@ void ipv6Host() {
213
213
assertThat (headers .getFirst ("Host" )).as ("Invalid Host header" ).isEqualTo ("[::1]" );
214
214
}
215
215
216
+ @ Test
217
+ void hostDeletion () {
218
+ InetSocketAddress host = InetSocketAddress .createUnresolved ("localhost" , 8080 );
219
+ headers .setHost (host );
220
+ headers .setHost (null );
221
+ assertThat (headers .getHost ()).as ("Host is not deleted" ).isEqualTo (null );
222
+ assertThat (headers .getFirst ("Host" )).as ("Host is not deleted" ).isEqualTo (null );
223
+ }
224
+
216
225
@ Test
217
226
void eTagWithoutQuotes () {
218
227
headers .setETag ("v2.6" );
You can’t perform that action at this time.
0 commit comments