Search in sources :

Example 11 with Parameters

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());
}
Also used : HashParameters(io.helidon.common.http.HashParameters) Parameters(io.helidon.common.http.Parameters) HashParameters(io.helidon.common.http.HashParameters) Test(org.junit.jupiter.api.Test)

Example 12 with Parameters

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"));
}
Also used : Parameters(io.helidon.common.http.Parameters) Test(org.junit.jupiter.api.Test)

Example 13 with Parameters

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));
}
Also used : Parameters(io.helidon.common.http.Parameters) Test(org.junit.jupiter.api.Test)

Example 14 with Parameters

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"));
}
Also used : Parameters(io.helidon.common.http.Parameters) Test(org.junit.jupiter.api.Test)

Example 15 with Parameters

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"));
}
Also used : Parameters(io.helidon.common.http.Parameters) Test(org.junit.jupiter.api.Test)

Aggregations

Parameters (io.helidon.common.http.Parameters)16 Test (org.junit.jupiter.api.Test)11 HashParameters (io.helidon.common.http.HashParameters)3 HaInfo (com.sun.xml.ws.api.ha.HaInfo)1 DataChunk (io.helidon.common.http.DataChunk)1 Http (io.helidon.common.http.Http)1 MediaType (io.helidon.common.http.MediaType)1 ReadOnlyParameters (io.helidon.common.http.ReadOnlyParameters)1 MediaContext (io.helidon.media.common.MediaContext)1 MessageBodyReader (io.helidon.media.common.MessageBodyReader)1 JsonpSupport (io.helidon.media.jsonp.JsonpSupport)1 SecurityContext (io.helidon.security.SecurityContext)1 SecurityEnvironment (io.helidon.security.SecurityEnvironment)1 Handler (io.helidon.webserver.Handler)1 HttpException (io.helidon.webserver.HttpException)1 RequestPredicate (io.helidon.webserver.RequestPredicate)1 Routing (io.helidon.webserver.Routing)1 ServerRequest (io.helidon.webserver.ServerRequest)1 WebServer (io.helidon.webserver.WebServer)1 JerseySupport (io.helidon.webserver.jersey.JerseySupport)1