File tree Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -96,7 +96,7 @@ public function afterCompile(Nette\PhpGenerator\ClassType $class)
9696
9797 $ initialize = $ class ->getMethod ('initialize ' );
9898 $ config = $ this ->getConfig ();
99- $ headers = $ config ['headers ' ];
99+ $ headers = array_map ( ' strval ' , $ config ['headers ' ]) ;
100100
101101 if (isset ($ config ['frames ' ]) && $ config ['frames ' ] !== true && !isset ($ headers ['X-Frame-Options ' ])) {
102102 $ frames = $ config ['frames ' ];
@@ -130,7 +130,7 @@ public function afterCompile(Nette\PhpGenerator\ClassType $class)
130130
131131 $ code [] = Helpers::formatArgs ('$response = $this->getService(?); ' , [$ this ->prefix ('response ' )]);
132132 foreach ($ headers as $ key => $ value ) {
133- if ($ value != null ) { // intentionally ==
133+ if ($ value !== '' ) {
134134 $ code [] = Helpers::formatArgs ('$response->setHeader(?, ?); ' , [$ key , $ value ]);
135135 }
136136 }
Original file line number Diff line number Diff line change 2626 headers:
2727 A: b
2828 C:
29+ D: 0
2930EOD
3031, 'neon ' ));
3132
@@ -39,6 +40,7 @@ Assert::contains('X-Frame-Options: SAMEORIGIN', $headers);
3940Assert::contains ('Content-Type: text/html; charset=utf-8 ' , $ headers );
4041Assert::contains ('X-Powered-By: Nette Framework 3 ' , $ headers );
4142Assert::contains ('A: b ' , $ headers );
43+ Assert::contains ('D: 0 ' , $ headers );
4244Assert::notContains ('C: ' , $ headers );
4345
4446
You can’t perform that action at this time.
0 commit comments