RequestParser { Map<String, String> decodeCookies(Iterable<Cookie> cookies) { Map<String, String> cookieValues = new HashMap<>(); for (Cookie cookie : cookies) { String name = cookie.getName(); String value = cookie.getValue(); try { String cookieName = decodeURIComponent(name); String cookieValue = decodeURIComponent(value); logger.debug("[request:cookie] {}={}", cookieName, new FieldLogParam(cookieName, cookieValue)); cookieValues.put(cookieName, cookieValue); } catch (IllegalArgumentException e) { logger.warn(errorCode("INVALID_COOKIE"), "ignore invalid encoded cookie, name={}, value={}", name, value, e); } } return cookieValues; }  void parse(RequestImpl request, HttpServerExchange exchange, ActionLog actionLog); final ClientIPParser clientIPParser; public boolean logSiteHeaders; }
@Test void decodeInvalidCookieValue() { Map<String, String> cookies = parser.decodeCookies(Set.of(new CookieImpl("name", "%%"))); assertThat(cookies).isEmpty(); }