Discards the given cookie. The cookie max-age is set to 0, so is going to be invalidated.

@param name the name of the cookie
@return the current result
331077
public Result discard(String name) {
        Cookie cookie = getCookie(name);
        if (cookie != null) {
            cookies.remove(cookie);
            cookies.add(Cookie.builder(cookie).setMaxAge(0).build());
        } else {
            cookies.add(Cookie.builder(name, "").setMaxAge(0).build());
        }
        return this;
    }
295976
public boolean deleteFile(String name) {
        if (this.svgCacheDir != null) {
            return new File(this.svgCacheDir, name).delete();
        }
        return this.application.deleteFile(name);
    }
547648
function(name) {
    var cookie = this.cookies[name]
    if (cookie && this.checkNotExpired(name)) {
      return this.cookies[name].value
    }
    return null
  }
568913
public static boolean removeCookie(String name, Cookie[] cookies, HttpServletResponse response) {
        if (Checker.isNotEmpty(name) && Checker.isNotEmpty(cookies)) {
            for (Cookie cookie : cookies) {
                if (name.equals(cookie.getName())) {
                    return removeCookie(cookie, response);
                }
            }
        }
        return false;
    }
458310
public function deleteCookie($name = null)
    {
        if (isset($name)) {

            if (isset($this->request['cookie'][$name])) {
                unset($this->request['cookie'][$name]);
                return setcookie($name, '', GC_TIME - 3600, '/');
            }

            return false;
        }

        foreach (array_keys($this->request['cookie']) as $key) {
            $this->deleteCookie($key);
        }

        return true;
    }
1331959
def del_cookie(self, name: str, *,
                   domain: Optional[str]=None,
                   path: str='/') -> None:
        
        # TODO: do we need domain/path here?
        self._cookies.pop(name, None)
        self.set_cookie(name, '', max_age=0,
                        expires="Thu, 01 Jan 1970 00:00:00 GMT",
                        domain=domain, path=path)
620415
public static String getCookieValue(Cookie[] cookies, String name) {

        for (int i = 0; (cookies != null) && (i < cookies.length); i++) {
            if (name.equalsIgnoreCase(cookies[i].getName())) {
                return cookies[i].getValue();
            }
        }
        return null;
    }
1316109
public static Cookie getCookie(final Collection<Cookie> cookies, final String name) {
        if (cookies != null) {
            for (final Cookie cookie : cookies) {
                if (cookie != null && CommonHelper.areEquals(name, cookie.getName())) {
                    return cookie;
                }
            }
        }
        return null;
    }
528074
protected function deleteCookie($name)
    {
        $nameEscaped = json_encode($name);

        $js = <<<JS
(function(){
    var path = location.pathname;

    do {
        document.cookie = {$nameEscaped} + '=; path=' + path + '; expires=Thu, 01 Jan 1970 00:00:00 GMT';
        path = path.replace(/.$/, '');
    } while (path);
})()
JS;

        try {
            $this->executeScript($js);
        } catch (\Exception $e) {
            // ignore error
        }
    }
937214
protected function setCookie($name, $id)
    {
        $expire = $this->cookie_lifetime ? time() + (int)$this->cookie_lifetime : 0;
        return setcookie(
            $name,
            $id,
            $expire,
            $this->cookie_path,
            $this->cookie_domain,
            (bool)$this->cookie_secure,
            (bool)$this->cookie_httponly
        );
    }
187679
public void deleteCookie(String cookieName) {
        String action = "Deleting cookie <i>" + cookieName + "</i>";
        String expected = "Cookie <i>" + cookieName + "</i> is removed";
        try {
            Cookie cookie = driver.manage().getCookieNamed(cookieName);
            if (cookie == null) {
                reporter.fail(action, expected,
                        "Unable to remove cookie <i>" + cookieName + "</i> as it doesn't exist.");
                return;
            }
            driver.manage().deleteCookieNamed(cookieName);
        } catch (Exception e) {
            reporter.fail(action, expected, "Unable to remove cookie <i>" + cookieName + "</i>. " + e.getMessage());
            log.warn(e);
            return;
        }
        reporter.pass(action, expected, expected);
    }
71027
@Override
    public Object remove(String name) {
        final HttpSession session = this.getPortalSesion(false);
        if (session == null) {
            return null;
        }

        final Object sessionMutex = WebUtils.getSessionMutex(session);
        synchronized (sessionMutex) {
            final Object attribute = session.getAttribute(name);
            if (attribute != null) {
                session.removeAttribute(name);
            }

            return attribute;
        }
    }
30635
protected Cookie getCookieFromRequest(String name, HttpServletRequest request) {
        final Cookie[] cookies = request.getCookies();
        if (cookies == null) { // getCookies() returns null if there aren't any
            return null;
        }

        for (final Cookie cookie : cookies) {
            if (name.equals(cookie.getName())) {
                return cookie;
            }
        }

        return null;
    }
204556
public function expireCookie(ResponseInterface $response, $name)
    {
        $cookie = SetCookie::createExpired($name)
            ->withMaxAge($this->configuration['maxAge'])
            ->withPath($this->configuration['path'])
            ->withDomain($this->configuration['domain'])
            ->withSecure($this->configuration['secure'])
            ->withHttpOnly($this->configuration['httpOnly']);

        return $response->withAddedHeader(static::RESPONSE_COOKIE_NAME, $cookie);
    }
1226457
public static void deleteCookie(HttpServletResponse response, Cookie cookie, String path) {
    if (cookie != null) {
      // Delete the cookie by setting its maximum age to zero
      cookie.setMaxAge(0);
      cookie.setPath(path);
      response.addCookie(cookie);
    }
  }
818627
public void deleteCookie(HttpServletRequest request, HttpServletResponse response, String cookieName, WebAppSecurityConfig webAppSecConfig) {
        ReferrerURLCookieHandler referrerURLCookieHandler = getCookieHandler();
        referrerURLCookieHandler.clearReferrerURLCookie(request, response, cookieName);

        Cookie paramCookie = createExpiredCookie(request, cookieName, webAppSecConfig);
        response.addCookie(paramCookie);
    }
548457
public function remove($name)
    {
        $new = clone $this;
        $key = mb_strtolower($name);
        foreach ($new->cookies as $i => $cookie) {
            if (mb_strtolower($cookie->getName()) === $key) {
                unset($new->cookies[$i]);
            }
        }

        return $new;
    }