public function setETag(EventInterface $event) {
        $response = $event->getResponse();
        $request = $event->getRequest();

        $routesWithETags = [
            'user' => true,
            'images' => true,
            'image' => true,
            'metadata' => true,
            'globalshorturl' => true,
        ];
        $currentRoute = (string) $request->getRoute();

        if (!isset($routesWithETags[$currentRoute])) {
            // The current route does not use ETags
            return;
        }

        if ($response->isOk()) {
            $response->setETag('"' . md5($response->getContent()) . '"');
        }
    }
public function setETag(EventInterface $event) {
        $response = $event->getResponse();
        $request = $event->getRequest();

        $routesWithETags = [
            'user' => true,
            'images' => true,
            'image' => true,
            'metadata' => true,
            'globalshorturl' => true,
        ];
        $currentRoute = (string) $request->getRoute();

        if (!isset($routesWithETags[$currentRoute])) {
            // The current route does not use ETags
            return;
        }

        if ($response->isOk()) {
            $response->setETag('"' . md5($response->getContent()) . '"');
        }
    }
public function setETag ( EventInterface $ event ) { $ response = $ event -> getResponse ( ) ; $ request = $ event -> getRequest ( ) ; $ routesWithETags = [ 'user' => true , 'images' => true , 'image' => true , 'metadata' => true , 'globalshorturl' => true , ] ; $ currentRoute = ( string ) $ request -> getRoute ( ) ; if ( ! isset ( $ routesWithETags [ $ currentRoute ] ) ) { // The current route does not use ETags return ; } if ( $ response -> isOk ( ) ) { $ response -> setETag ( '"' . md5 ( $ response -> getContent ( ) ) . '"' ) ; } }
Set the correct ETag for the response

@param EventInterface $event The current event
Set the correct ETag for the response