protected function RequestHandler::prepareResponse in Drupal 8
Same name and namespace in other branches
- 9 core/modules/rest/src/RequestHandler.php \Drupal\rest\RequestHandler::prepareResponse()
Prepares the REST resource response.
Parameters
\Drupal\rest\ResourceResponseInterface $response: The REST resource response.
\Drupal\rest\RestResourceConfigInterface $resource_config: The REST resource config entity.
Return value
\Drupal\rest\ResourceResponseInterface The prepared REST resource response.
2 calls to RequestHandler::prepareResponse()
- RequestHandler::handle in core/
modules/ rest/ src/ RequestHandler.php - Handles a REST API request.
- RequestHandler::handleRaw in core/
modules/ rest/ src/ RequestHandler.php - Handles a REST API request without deserializing the request body.
File
- core/
modules/ rest/ src/ RequestHandler.php, line 114
Class
- RequestHandler
- Acts as intermediate request forwarder for resource plugins.
Namespace
Drupal\restCode
protected function prepareResponse($response, RestResourceConfigInterface $resource_config) {
if ($response instanceof CacheableResponseInterface) {
$response
->addCacheableDependency($resource_config);
// Add global rest settings config's cache tag, for BC flags.
// @see \Drupal\rest\Plugin\rest\resource\EntityResource::permissions()
// @see \Drupal\rest\EventSubscriber\RestConfigSubscriber
// @todo Remove in https://www.drupal.org/node/2893804
$response
->addCacheableDependency($this->configFactory
->get('rest.settings'));
}
return $response;
}