Skip to content

Commit

Permalink
feature: ViewAction RequestMapping need hx-request header
Browse files Browse the repository at this point in the history
  • Loading branch information
tschuehly committed Sep 14, 2023
1 parent 9461ab9 commit 4ff9bb4
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 4ff9bb4

Please sign in to comment.