Helthe\Component\Turbolinks\Turbolinks::addRequestMethodCookie PHP Method

addRequestMethodCookie() private method

Adds a cookie with the request method for non-GET requests. If a cookie is present and the request is GET, the cookie is removed to work better with caching solutions. The turbolinks will not initialize if the cookie is set.
private addRequestMethodCookie ( Request $request, Response $response )
$request Symfony\Component\HttpFoundation\Request
$response Symfony\Component\HttpFoundation\Response
    private function addRequestMethodCookie(Request $request, Response $response)
    {
        if ($request->isMethod('GET') && $request->cookies->has(self::REQUEST_METHOD_COOKIE_ATTR_NAME)) {
            $response->headers->clearCookie(self::REQUEST_METHOD_COOKIE_ATTR_NAME);
        }
        if (!$request->isMethod('GET')) {
            $response->headers->setCookie(new Cookie(self::REQUEST_METHOD_COOKIE_ATTR_NAME, $request->getMethod()));
        }
    }