From 4ff9bb46545b5d406e0068aa6eb63a8904555c30 Mon Sep 17 00:00:00 2001 From: Thomas Schuehly Date: Thu, 14 Sep 2023 15:14:16 +0200 Subject: [PATCH] feature: ViewAction RequestMapping need hx-request header --- .../spring/viewcomponent/core/action/ViewActionConfiguration.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/src/main/kotlin/de/tschuehly/spring/viewcomponent/core/action/ViewActionConfiguration.kt b/core/src/main/kotlin/de/tschuehly/spring/viewcomponent/core/action/ViewActionConfiguration.kt index cf11454..cf95317 100644 --- a/core/src/main/kotlin/de/tschuehly/spring/viewcomponent/core/action/ViewActionConfiguration.kt +++ b/core/src/main/kotlin/de/tschuehly/spring/viewcomponent/core/action/ViewActionConfiguration.kt @@ -12,6 +12,7 @@ import org.springframework.web.util.pattern.PathPatternParser import java.lang.reflect.Method import de.tschuehly.spring.viewcomponent.core.action.ViewActionRegistry.PathMapping import org.slf4j.LoggerFactory +import org.springframework.web.servlet.mvc.condition.HeadersRequestCondition @Configuration class ViewActionConfiguration( @@ -85,6 +86,7 @@ class ViewActionConfiguration( options.patternParser = parser requestMappingHandlerMapping.registerMapping( /* mapping = */ RequestMappingInfo.paths(mapping.path) + .customCondition(HeadersRequestCondition("HX-Request")) .methods(mapping.requestMethod).options(options).build(), /* handler = */ viewComponentBean, /* method = */ mapping.method