From b92e1dd1ca67adfb4f3a1be0c77ab3d10eaea783 Mon Sep 17 00:00:00 2001 From: David BRASSELY Date: Wed, 5 Jan 2022 23:55:33 +0100 Subject: [PATCH] feat(headers): Internal rework and introduce HTTP Headers API Closes gravitee-io/issues#6772 --- pom.xml | 10 +++++++++- .../requestvalidation/RequestValidationPolicyTest.java | 6 +++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index a720b04..c36dcce 100644 --- a/pom.xml +++ b/pom.xml @@ -35,7 +35,8 @@ 1.0 - 1.26.0 + 1.31.0-SNAPSHOT + 1.8.0-SNAPSHOT 1.10.0 1.18.0 2.0.14 @@ -72,6 +73,13 @@ provided + + io.gravitee.el + gravitee-expression-language + ${gravitee-expression-language.version} + provided + + io.gravitee.common gravitee-common diff --git a/src/test/java/io/gravitee/policy/requestvalidation/RequestValidationPolicyTest.java b/src/test/java/io/gravitee/policy/requestvalidation/RequestValidationPolicyTest.java index 0aebae0..532634f 100644 --- a/src/test/java/io/gravitee/policy/requestvalidation/RequestValidationPolicyTest.java +++ b/src/test/java/io/gravitee/policy/requestvalidation/RequestValidationPolicyTest.java @@ -15,7 +15,6 @@ */ package io.gravitee.policy.requestvalidation; -import io.gravitee.common.http.HttpHeaders; import io.gravitee.common.http.HttpStatusCode; import io.gravitee.common.util.MultiValueMap; import io.gravitee.el.TemplateEngine; @@ -23,6 +22,7 @@ import io.gravitee.gateway.api.Request; import io.gravitee.gateway.api.Response; import io.gravitee.gateway.api.el.EvaluableRequest; +import io.gravitee.gateway.api.http.HttpHeaders; import io.gravitee.policy.api.PolicyChain; import io.gravitee.policy.requestvalidation.configuration.RequestValidationPolicyConfiguration; import io.gravitee.policy.requestvalidation.validator.*; @@ -163,7 +163,7 @@ public void shouldValidateQueryParameter_multipleRules() { when(request.parameters()).thenReturn(parameters); HttpHeaders headers = mock(HttpHeaders.class); - when(headers.get("my-header")).thenReturn(Collections.singletonList("header-value")); + when(headers.getAll("my-header")).thenReturn(Collections.singletonList("header-value")); when(request.headers()).thenReturn(headers); // Prepare template engine @@ -272,7 +272,7 @@ public void shouldValidateTheOrderOfViolationsWhenUsingMultipleRules() { final String PATTERN = "^[0-9a-fA-F]{32}\\z"; HttpHeaders headers = mock(HttpHeaders.class); - when(headers.get("my-header")).thenReturn(null); + when(headers.getAll("my-header")).thenReturn(null); when(request.headers()).thenReturn(headers); // Prepare template engine