src/Http/ContentNegotiation/NegotiatedResponseFactory.php
private function createNotAcceptableException(string $type): HttpException
    {
        $headers = new HttpHeaders();
        $headers->add('Content-Type', 'application/json');
        $body = new StringBody(json_encode($this->contentNegotiator->getAcceptableResponseMediaTypes($type)));
        $response = new Response(HttpStatusCodes::HTTP_NOT_ACCEPTABLE, $headers, $body);

        return new HttpException($response);
    }
private function createNotAcceptableException(string $type): HttpException
    {
        $headers = new HttpHeaders();
        $headers->add('Content-Type', 'application/json');
        $body = new StringBody(json_encode($this->contentNegotiator->getAcceptableResponseMediaTypes($type)));
        $response = new Response(HttpStatusCodes::HTTP_NOT_ACCEPTABLE, $headers, $body);

        return new HttpException($response);
    }
Creates a 406 Not Acceptable exception

@param string $type The type that was attempted to be written
@return HttpException The exception with the response set