File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -124,6 +124,18 @@ public function addHeader(string $name, string $value)
124124 }
125125
126126
127+ /**
128+ * @return static
129+ * @throws Nette\InvalidStateException if HTTP headers have been sent
130+ */
131+ public function deleteHeader (string $ name )
132+ {
133+ self ::checkHeaders ();
134+ header_remove ($ name );
135+ return $ this ;
136+ }
137+
138+
127139 /**
128140 * Sends a Content-type HTTP header.
129141 * @return static
Original file line number Diff line number Diff line change @@ -36,3 +36,9 @@ Assert::same('one', $response->getHeader('APPEND'));
3636$ headers = $ response ->getHeaders ();
3737Assert::contains ('two ' , $ headers ['replace ' ]);
3838Assert::contains ('two ' , $ headers ['append ' ]);
39+
40+
41+ $ response ->deleteHeader ('append ' );
42+ $ headers = $ response ->getHeaders ();
43+ Assert::contains ('two ' , $ headers ['replace ' ]);
44+ Assert::false (isset ($ headers ['append ' ]));
You can’t perform that action at this time.
0 commit comments