use of io.helidon.common.http.Parameters in project helidon by oracle.
the class HashParametersTest method concatNullAndEmpty.
@Test
public void concatNullAndEmpty() throws Exception {
Parameters[] prms = null;
HashParameters concat = HashParameters.concat(prms);
assertThat(concat, notNullValue());
prms = new Parameters[10];
concat = HashParameters.concat(prms);
assertThat(concat, notNullValue());
concat = HashParameters.concat();
assertThat(concat, notNullValue());
}
use of io.helidon.common.http.Parameters in project helidon by oracle.
the class HashRequestHeadersTest method cookies.
@Test
public void cookies() {
HashRequestHeaders hs = withHeader(Http.Header.COOKIE, "foo=bar; aaa=bbb; c=what_the_hell; aaa=ccc", "$version=1; some=other; $Domain=google.com, aaa=eee, d=cool; $Domain=google.com; $Path=\"/foo\"");
Parameters cookies = hs.cookies();
assertThat(cookies.all("foo"), contains("bar"));
assertThat(cookies.all("c"), contains("what_the_hell"));
assertThat(cookies.all("aaa"), contains("bbb", "ccc", "eee"));
assertThat(cookies.all("some"), contains("other"));
assertThat(cookies.all("d"), contains("cool"));
}
use of io.helidon.common.http.Parameters in project helidon by oracle.
the class CookieParserTest method rfc2965.
@Test
public void rfc2965() throws Exception {
String header = "$version=1; foo=bar; $Domain=google.com, aaa=bbb, c=cool; $Domain=google.com; $Path=\"/foo\"";
Parameters p = HashRequestHeaders.CookieParser.parse(header);
assertThat(p, notNullValue());
assertThat(p.all("foo"), contains("bar"));
assertThat(p.all("aaa"), contains("bbb"));
assertThat(p.all("c"), contains("cool"));
assertThat(p.first("$Domain").isPresent(), is(false));
assertThat(p.first("$Path").isPresent(), is(false));
assertThat(p.first("$Version").isPresent(), is(false));
}
use of io.helidon.common.http.Parameters in project helidon by oracle.
the class CookieParserTest method basicMultiValue.
@Test
public void basicMultiValue() throws Exception {
Parameters p = HashRequestHeaders.CookieParser.parse("foo=bar; aaa=bbb; c=what_the_hell; aaa=ccc");
assertThat(p, notNullValue());
assertThat(p.all("foo"), contains("bar"));
assertThat(p.all("aaa"), contains("bbb", "ccc"));
assertThat(p.all("c"), contains("what_the_hell"));
}
use of io.helidon.common.http.Parameters in project helidon by oracle.
the class CookieParserTest method unquote.
@Test
public void unquote() throws Exception {
Parameters p = HashRequestHeaders.CookieParser.parse("foo=\"bar\"; aaa=bbb; c=\"what_the_hell\"; aaa=\"ccc\"");
assertThat(p, notNullValue());
assertThat(p.all("foo"), contains("bar"));
assertThat(p.all("aaa"), contains("bbb", "ccc"));
}
Aggregations