comparison core/modules/rest/src/EventSubscriber/ResourceResponseSubscriber.php @ 5:12f9dff5fda9 tip

Update to Drupal core 8.7.1
author Chris Cannam
date Thu, 09 May 2019 15:34:47 +0100
parents c75dbcec494b
children
comparison
equal deleted inserted replaced
4:a9cd425dd02b 5:12f9dff5fda9
205 protected function flattenResponse(ResourceResponseInterface $response) { 205 protected function flattenResponse(ResourceResponseInterface $response) {
206 $final_response = ($response instanceof CacheableResponseInterface) ? new CacheableResponse() : new Response(); 206 $final_response = ($response instanceof CacheableResponseInterface) ? new CacheableResponse() : new Response();
207 $final_response->setContent($response->getContent()); 207 $final_response->setContent($response->getContent());
208 $final_response->setStatusCode($response->getStatusCode()); 208 $final_response->setStatusCode($response->getStatusCode());
209 $final_response->setProtocolVersion($response->getProtocolVersion()); 209 $final_response->setProtocolVersion($response->getProtocolVersion());
210 $final_response->setCharset($response->getCharset()); 210 if ($response->getCharset()) {
211 $final_response->setCharset($response->getCharset());
212 }
211 $final_response->headers = clone $response->headers; 213 $final_response->headers = clone $response->headers;
212 if ($final_response instanceof CacheableResponseInterface) { 214 if ($final_response instanceof CacheableResponseInterface) {
213 $final_response->addCacheableDependency($response->getCacheableMetadata()); 215 $final_response->addCacheableDependency($response->getCacheableMetadata());
214 } 216 }
215 return $final_response; 217 return $final_response;