Skip to content
Snippets Groups Projects

Use constant Routes::JSON_API_ROUTE_FLAG_KEY instead of hard-coded string

1 file
+ 1
1
Compare changes
  • Side-by-side
  • Inline
@@ -88,7 +88,7 @@ class ResponseSubscriber implements EventSubscriberInterface {
return;
}
$route_defaults = $this->routeMatch->getRouteObject()->getDefaults();
if (Routes::isJsonApiRequest($route_defaults) || !empty($route_defaults['_is_jsonapi'])) {
if (Routes::isJsonApiRequest($route_defaults) || !empty($route_defaults[Routes::JSON_API_ROUTE_FLAG_KEY])) {
$response = $event->getResponse();
if ($response instanceof CacheableResponseInterface) {
$response->getCacheableMetadata()->addCacheContexts(['url.query_args:jsonapi_include']);
Loading