Search in sources :

Example 21 with Cookie

use of io.undertow.server.handlers.Cookie in project undertow by undertow-io.

the class CookiesTestCase method testEmptyCookieNames.

@Test
public void testEmptyCookieNames() {
    Map<String, Cookie> cookies = Cookies.parseRequestCookies(4, false, Arrays.asList("=foo; CUSTOMER=WILE_E_COYOTE=THE_COYOTE; =foobar; SHIPPING=FEDEX; =bar"));
    Cookie cookie = cookies.get("CUSTOMER");
    Assert.assertNotNull(cookie);
    Assert.assertEquals("WILE_E_COYOTE", cookie.getValue());
    cookie = cookies.get("SHIPPING");
    Assert.assertNotNull(cookie);
    Assert.assertEquals("FEDEX", cookie.getValue());
    cookie = cookies.get("");
    Assert.assertNotNull(cookie);
    Assert.assertEquals("foo", cookie.getValue());
}
Also used : Cookie(io.undertow.server.handlers.Cookie) UnitTest(io.undertow.testutils.category.UnitTest) Test(org.junit.Test)

Aggregations

Cookie (io.undertow.server.handlers.Cookie)21 UnitTest (io.undertow.testutils.category.UnitTest)12 Test (org.junit.Test)12 CookieImpl (io.undertow.server.handlers.CookieImpl)4 HttpString (io.undertow.util.HttpString)2 NotificationReceiver (io.undertow.security.api.NotificationReceiver)1 SecurityNotification (io.undertow.security.api.SecurityNotification)1 Account (io.undertow.security.idm.Account)1 Session (io.undertow.server.session.Session)1 HeaderMap (io.undertow.util.HeaderMap)1 HeaderValues (io.undertow.util.HeaderValues)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 TreeMap (java.util.TreeMap)1 HttpCookie (org.springframework.http.HttpCookie)1 ResponseCookie (org.springframework.http.ResponseCookie)1 LinkedMultiValueMap (org.springframework.util.LinkedMultiValueMap)1