File tree 2 files changed +17
-0
lines changed
main/java/io/netty/handler/codec/http2
test/java/io/netty/handler/codec/http2
2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -90,6 +90,12 @@ public DefaultHttp2Headers(boolean validate) {
90
90
validate ? HTTP2_NAME_VALIDATOR : NameValidator .NOT_NULL );
91
91
}
92
92
93
+ @ Override
94
+ public Http2Headers clear () {
95
+ this .firstNonPseudo = head ;
96
+ return super .clear ();
97
+ }
98
+
93
99
@ Override
94
100
public Http2Headers method (CharSequence value ) {
95
101
set (PseudoHeaderName .METHOD .value (), value );
Original file line number Diff line number Diff line change 22
22
23
23
import java .util .Map .Entry ;
24
24
25
+ import static org .junit .Assert .assertEquals ;
25
26
import static org .junit .Assert .assertFalse ;
26
27
import static org .junit .Assert .assertNotNull ;
27
28
import static org .junit .Assert .assertTrue ;
@@ -74,6 +75,16 @@ public void testHeaderNameValidation() {
74
75
headers .add (of ("Foo" ), of ("foo" ));
75
76
}
76
77
78
+ @ Test
79
+ public void testClearResetsPseudoHeaderDivision () {
80
+ DefaultHttp2Headers http2Headers = new DefaultHttp2Headers ();
81
+ http2Headers .method ("POST" );
82
+ http2Headers .set ("some" , "value" );
83
+ http2Headers .clear ();
84
+ http2Headers .method ("GET" );
85
+ assertEquals (1 , http2Headers .names ().size ());
86
+ }
87
+
77
88
private static void verifyAllPseudoHeadersPresent (Http2Headers headers ) {
78
89
for (PseudoHeaderName pseudoName : PseudoHeaderName .values ()) {
79
90
assertNotNull (headers .get (pseudoName .value ()));
You can’t perform that action at this time.
0 commit comments