We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 38ec9d6 commit f16e8f5Copy full SHA for f16e8f5
src/WP_REST_PSR7_Response.php
@@ -95,10 +95,17 @@ class WP_REST_PSR7_Response extends \WP_REST_Response implements ResponseInterfa
95
*/
96
public static function fromPSR7Response(ResponseInterface $response)
97
{
98
+ // Since PSR7 response has the headers as an array of arrays,
99
+ // we need to convert it to a simple associative array
100
+ $headers = [];
101
+ $responseHeaders = $response->getHeaders();
102
+ foreach ($responseHeaders as $name => $values) {
103
+ $headers[$name] = $values;
104
+ }
105
return new self(
106
(string)$response->getBody(),
107
$response->getStatusCode(),
- $response->getHeaders()
108
+ $headers,
109
);
110
}
111
0 commit comments