File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
spring-web/src/main/java/org/springframework/http Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright 2002-2018 the original author or authors.
2
+ * Copyright 2002-2019 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -1694,11 +1694,15 @@ public static HttpHeaders readOnlyHttpHeaders(HttpHeaders headers) {
1694
1694
}
1695
1695
1696
1696
/**
1697
- * Return a {@code HttpHeaders} object that can read and written to.
1697
+ * Return a {@code HttpHeaders} object that can be read and written to.
1698
+ * @since 5.1.1
1698
1699
*/
1699
1700
public static HttpHeaders writableHttpHeaders (HttpHeaders headers ) {
1700
1701
Assert .notNull (headers , "HttpHeaders must not be null" );
1701
- if (headers instanceof ReadOnlyHttpHeaders ) {
1702
+ if (headers == EMPTY ) {
1703
+ return new HttpHeaders ();
1704
+ }
1705
+ else if (headers instanceof ReadOnlyHttpHeaders ) {
1702
1706
return new HttpHeaders (headers .headers );
1703
1707
}
1704
1708
else {
You can’t perform that action at this time.
0 commit comments