Search in sources :

Example 11 with CookieSpec

use of org.apache.commons.httpclient.cookie.CookieSpec in project zaproxy by zaproxy.

the class ZapCookieSpecUnitTest method shouldThrowWhenValidatingWithNullHost.

@Test
void shouldThrowWhenValidatingWithNullHost() throws MalformedCookieException {
    // Given
    CookieSpec cookieSpec = createCookieSpec();
    String host = null;
    // When / Then
    assertThrows(IllegalArgumentException.class, () -> cookieSpec.validate(host, PORT, PATH, SECURE, new Cookie()));
}
Also used : Cookie(org.apache.commons.httpclient.Cookie) CookieSpec(org.apache.commons.httpclient.cookie.CookieSpec) Test(org.junit.jupiter.api.Test)

Example 12 with CookieSpec

use of org.apache.commons.httpclient.cookie.CookieSpec in project zaproxy by zaproxy.

the class ZapCookieSpecUnitTest method shouldBeValidEvenIfCookiePathIsDifferentThanOrigin.

@Test
void shouldBeValidEvenIfCookiePathIsDifferentThanOrigin() throws MalformedCookieException {
    // Given
    CookieSpec cookieSpec = createCookieSpec();
    Cookie cookie = new Cookie(HOST, "name", "value");
    cookie.setPath("/other/path/");
    // When / Then
    assertDoesNotThrow(() -> cookieSpec.validate(HOST, PORT, PATH, SECURE, cookie));
}
Also used : Cookie(org.apache.commons.httpclient.Cookie) CookieSpec(org.apache.commons.httpclient.cookie.CookieSpec) Test(org.junit.jupiter.api.Test)

Aggregations

CookieSpec (org.apache.commons.httpclient.cookie.CookieSpec)12 Cookie (org.apache.commons.httpclient.Cookie)8 Test (org.junit.jupiter.api.Test)8 CookieVersionSupport (org.apache.commons.httpclient.cookie.CookieVersionSupport)4 HttpHeader (org.parosproxy.paros.network.HttpHeader)2