public function setExposedHeaders(EventInterface $event) {
        // If this request was disallowed, don't expose any headers
        if (!$this->requestAllowed) {
            return;
        }

        $headers = [
            // The ResponseSender-listener will add this header and send the response,
            // so we have no way to pick it up - instead we'll always whitelist it
            'X-Imbo-ImageIdentifier'
        ];

        foreach ($event->getResponse()->headers as $header => $value) {
            if (strpos($header, 'x-imbo') === 0) {
                $headers[] = implode('-', array_map('ucfirst', explode('-', $header)));;
            }
        }

        $event->getResponse()->headers->add([
            'Access-Control-Expose-Headers' => implode(', ', $headers)
        ]);
    }
public function setExposedHeaders(EventInterface $event) {
        // If this request was disallowed, don't expose any headers
        if (!$this->requestAllowed) {
            return;
        }

        $headers = [
            // The ResponseSender-listener will add this header and send the response,
            // so we have no way to pick it up - instead we'll always whitelist it
            'X-Imbo-ImageIdentifier'
        ];

        foreach ($event->getResponse()->headers as $header => $value) {
            if (strpos($header, 'x-imbo') === 0) {
                $headers[] = implode('-', array_map('ucfirst', explode('-', $header)));;
            }
        }

        $event->getResponse()->headers->add([
            'Access-Control-Expose-Headers' => implode(', ', $headers)
        ]);
    }
public function setExposedHeaders ( EventInterface $ event ) { // If this request was disallowed, don't expose any headers if ( ! $ this -> requestAllowed ) { return ; } $ headers = [ // The ResponseSender-listener will add this header and send the response, // so we have no way to pick it up - instead we'll always whitelist it 'X-Imbo-ImageIdentifier' ] ; foreach ( $ event -> getResponse ( ) -> headers as $ header => $ value ) { if ( strpos ( $ header , 'x-imbo' ) === 0 ) { $ headers [ ] = implode ( '-' , array_map ( 'ucfirst' , explode ( '-' , $ header ) ) ) ; ; } } $ event -> getResponse ( ) -> headers -> add ( [ 'Access-Control-Expose-Headers' => implode ( ', ' , $ headers ) ] ) ; }
Right before the response is sent to the client, whitelist all included Imbo-headers in the
"Access-Control-Expose-Headers"-header

@param EventInterface $event The event instance
Right before the response is sent to the client whitelist all included Imbo - headers in the Access - Control - Expose - Headers - header