@@ -53,6 +53,8 @@ public function __construct(ConfigurationInterface $conf)
5353 /**
5454 * Prepare headers before handling requests.
5555 *
56+ * https://tools.ietf.org/html/rfc5988#section-5.5
57+ *
5658 * @return void
5759 */
5860 private function prepareBeforeRequest (): void
@@ -66,18 +68,21 @@ private function prepareBeforeRequest(): void
6668
6769 // Backward compatibility.
6870 if (!isset ($ values [0 ]['value ' ])) {
69- $ this ->prepared [$ item ][] = join ('; ' , (array ) $ values );
71+ $ this ->prepared [$ item ] = join ('; ' , (array ) $ values );
7072 }
7173
7274 // Checks new extended format for sent headers from yaml values.
7375 if (is_array ($ values ) && count ($ values ) > 0 && isset ($ values [0 ]['value ' ])) {
76+ $ array = [];
7477 foreach ($ values as $ value ) {
7578 if (!isset ($ value ['value ' ])) {
7679 throw new InvalidArgumentException ('Invalid header format, see docs & examples. ' );
7780 }
7881
79- $ this -> prepared [ $ item ] [] = join ('; ' , (array ) $ value ['value ' ]);
82+ $ array [] = join ('; ' , (array ) $ value ['value ' ]);
8083 }
84+
85+ $ this ->prepared [$ item ] = join (', ' , $ array );
8186 }
8287 }
8388 }
@@ -94,10 +99,8 @@ public function sent(Response $response): void
9499 $ response ->header ('software-server ' , '' );
95100 $ response ->header ('server ' , '' );
96101
97- foreach ($ this ->prepared as $ header => $ values ) {
98- foreach ($ values as $ value ) {
99- $ response ->header ($ header , $ value );
100- }
102+ foreach ($ this ->prepared as $ header => $ value ) {
103+ $ response ->header ($ header , $ value );
101104 }
102105 }
103106}
0 commit comments