Determine if the the response isn't a XHR(AJAX) Javascript one

@param  \Illuminate\Http\Request $request
@param  mixed $response
@return bool
164591
protected function nonXhrJavascriptResponse($request, $response)
    {
        return ($request->getFormat($response->headers->get('Content-Type')) === 'js' &&
            ! $request->ajax()
        );
    }
356305
public function handleNotFound(ServerRequestInterface $request, ResponseInterface $response)
    {
        return $this
            ->getContentTypeHandler($request)
            ->handleNotFound($request, $response);
    }
633055
protected function isAnHtmlResponse(Response $response)
    {
        $type = $response->headers->get('Content-Type');

        return strtolower(strtok($type, ';')) === 'text/html';
    }
704165
private function isErroneousResponse($response)
    {
        return (isset($response->type) and isset($response->title) and isset($response->status) and isset($response->detail));
    }
228934
function isXmlHttpRequest()
    {
        /** @var iHeader $header */
        if (! $this->getMessageObject()->headers()->has('X-Requested-With') )
            return false;

        $header = $this->getMessageObject()->headers()->get('X-Requested-With');
        return false !== $header && \Poirot\Http\Header\renderHeader($header) == 'XMLHttpRequest';
    }
629581
public function isAjax() {
        $value = $this->server('HTTP_X_REQUESTED_WITH');
        $result = ('xmlhttprequest' == strtolower($value)) ? true : false;
        return $result;
    }
1020804
public function resolve(Request $request, Response $response)
    {
        return $response->methodNotAllowed(
                $request->method(),
                $this->allowedMethods
        );
    }
1302118
public static function enabled_for($response)
    {
        $contentType = $response->getHeader("Content-Type");

        // Disable content negotiation for other content types
        if ($contentType
            && substr($contentType, 0, 9) != 'text/html'
            && substr($contentType, 0, 21) != 'application/xhtml+xml'
        ) {
            return false;
        }

        if (ContentNegotiator::getEnabled()) {
            return true;
        } else {
            return (substr($response->getBody(), 0, 5) == '<' . '?xml');
        }
    }
1194711
private function isReferrerAble($response)
    {
        if (!Response::isOk($response)) {
            return false;
        }
        $type = $response->getHeader('Content-Type');
        if (!$type || $type === 'text/html') {
            return true;
        }
        return false;
    }
1089584
private function isSuccessful(Response $response): bool
    {
        if ($response->statusCode()->value() !== 200) {
            return false;
        }

        $json = Json::decode((string) $response->body());

        return count($json['errors']) === 0;
    }
226264
private function canSave(RequestInterface $request, ResponseInterface $response)
    {
        if ($request->getMethod() !== 'GET') {
            return false;
        }

        if ($response->getStatusCode() !== 200) {
            return false;
        }

        if (!$this->appendQuery && !empty($request->getUri()->getQuery())) {
            return false;
        }

        if ($response->hasHeader('location')) {
            return false;
        }

        $cacheControl = $response->getHeaderLine('Cache-Control');

        if ($cacheControl && (stripos($cacheControl, 'no-cache') !== false || stripos($cacheControl, 'no-store') !== false)) {
            return false;
        }

        return true;
    }
948202
public function isAjax(): bool
    {
        if (isset($_SERVER['HTTP_X_REQUESTED_WITH'])) {
            return (strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest');
        }

        if (isset($_SERVER['HTTP_X_AJAX'])) {
            return (strtolower($_SERVER['HTTP_X_AJAX']) == 'true' || $_SERVER['HTTP_X_AJAX'] == '1');
        }

        return false;
    }
683956
public static function isPagingRequest(Request $request)
    {
        $matches = [];
        $found = preg_match('/page_[A-Za-z0-9_]+=(?!1\b)\d+/', $request->getRequestUri(), $matches);

        return (bool) $found;
    }
488054
protected function processGlobal($request, $response)
    {
        $args = array($request, $response);
        foreach ($this->globalMiddleware as $callback) {
            //bind callback
            $callback = $callback->bindTo($this, get_class($this));
            
            if (call_user_func_array($callback, $args) === false) {
                return false;
            }
        }
        
        return true;
    }
551064
public function applyPreInterceptors(Request $request, Response $response): bool
    {
        if ($this->isAuthorized($request, $response)) {
            return $this->actualResource->applyPreInterceptors($request, $response);
        }

        return true;
    }
1048290
public function check(Request $request, Response $response) {
        $actual = $request->getStage('csrf');
        $expected = $request->getSession('csrf');

        //no longer needed
        $request->removeSession('csrf');

        if($actual !== $expected) {
            //prepare to error
            $message = $this->app->package('global')->translate(static::ATTACK);
            $response->setError(true, $message);

            //and trigger a subflow
            $this->app->subflow($this->no, $request, $response);
            return $this;
        }

        //it passed
        $this->app->subflow($this->yes, $request, $response);
        return $this;
    }
1026717
public function isAjax()
    {
        $headers = apache_request_headers();
        $is_ajax = (isset($headers['X-Requested-With']) && $headers['X-Requested-With'] == 'XMLHttpRequest');

        return $is_ajax ? true : false;
    }