protected function respondWith(ResponseInterface $response, $contentType, $output)
    {
        $body = new Body(fopen('php://temp', 'r+'));
        $body->write($output);

        return $response->withHeader('Content-Type', $contentType)
            ->withBody($body);
    }