Search in sources :

Example 1 with LinkedMultiValueMap

use of io.gravitee.common.util.LinkedMultiValueMap in project gravitee-gateway by gravitee-io.

the class VertxHttpServerRequest method parameters.

@Override
public MultiValueMap<String, String> parameters() {
    if (queryParameters == null) {
        MultiMap parameters = httpServerRequest.params();
        queryParameters = new LinkedMultiValueMap<>(parameters.size());
        for (Map.Entry<String, String> param : httpServerRequest.params()) {
            queryParameters.put(param.getKey(), parameters.getAll(param.getKey()));
        }
    }
    return queryParameters;
}
Also used : MultiMap(io.vertx.core.MultiMap) MultiValueMap(io.gravitee.common.util.MultiValueMap) MultiMap(io.vertx.core.MultiMap) LinkedMultiValueMap(io.gravitee.common.util.LinkedMultiValueMap) Map(java.util.Map)

Example 2 with LinkedMultiValueMap

use of io.gravitee.common.util.LinkedMultiValueMap in project gravitee-gateway by gravitee-io.

the class ApiKeyAuthenticationHandlerTest method shouldHandleRequestUsingQueryParameters.

@Test
public void shouldHandleRequestUsingQueryParameters() {
    Request request = mock(Request.class);
    MultiValueMap<String, String> parameters = new LinkedMultiValueMap<>();
    parameters.put("api-key", Collections.singletonList("xxxxx-xxxx-xxxxx"));
    when(request.parameters()).thenReturn(parameters);
    HttpHeaders headers = new HttpHeaders();
    when(request.headers()).thenReturn(headers);
    boolean handle = authenticationHandler.canHandle(request);
    Assert.assertTrue(handle);
}
Also used : HttpHeaders(io.gravitee.common.http.HttpHeaders) LinkedMultiValueMap(io.gravitee.common.util.LinkedMultiValueMap) Request(io.gravitee.gateway.api.Request) Test(org.junit.Test)

Aggregations

LinkedMultiValueMap (io.gravitee.common.util.LinkedMultiValueMap)2 HttpHeaders (io.gravitee.common.http.HttpHeaders)1 MultiValueMap (io.gravitee.common.util.MultiValueMap)1 Request (io.gravitee.gateway.api.Request)1 MultiMap (io.vertx.core.MultiMap)1 Map (java.util.Map)1 Test (org.junit.Test)1