private function getContentTypeHandler(ServerRequestInterface $request)
    {
        $acceptHeader = $request->getHeaderLine('Accept');
        $acceptedTypes = explode(',', $acceptHeader);

        foreach ($this->handlers as $contentType => $handler) {
            if ($this->doesTypeMatch($acceptedTypes, $contentType)) {
                return $handler;
            }
        }

        return reset($this->handlers);
    }