public function call()
    {
        if (!$this->responseShouldHaveBody()) {

            $this->next->call();

            return;
        }

        $negotiator = new Negotiator();
        $format = $negotiator->getBest($this->app->request()->headers('Accept'));

        if ($format && in_array(($type = $format->getValue()), $this->validContentTypes)) {

            $this->app->contentType($type);
            $this->next->call();

            return;
        }

        $this->app->status(406); //Not acceptable
    }
public function call()
    {
        if (!$this->responseShouldHaveBody()) {

            $this->next->call();

            return;
        }

        $negotiator = new Negotiator();
        $format = $negotiator->getBest($this->app->request()->headers('Accept'));

        if ($format && in_array(($type = $format->getValue()), $this->validContentTypes)) {

            $this->app->contentType($type);
            $this->next->call();

            return;
        }

        $this->app->status(406); //Not acceptable
    }
public function call ( ) { if ( ! $ this -> responseShouldHaveBody ( ) ) { $ this -> next -> call ( ) ; return ; } $ negotiator = new Negotiator ( ) ; $ format = $ negotiator -> getBest ( $ this -> app -> request ( ) -> headers ( 'Accept' ) ) ; if ( $ format && in_array ( ( $ type = $ format -> getValue ( ) ) , $ this -> validContentTypes ) ) { $ this -> app -> contentType ( $ type ) ; $ this -> next -> call ( ) ; return ; } $ this -> app -> status ( 406 ) ; //Not acceptable }
Ensure the provided content type is valid and set the proper response content type

@see \Slim\Middleware::call()
Ensure the provided content type is valid and set the proper response content type