From ad2803bf8fcfad61d802ed75eb97d552506a2def Mon Sep 17 00:00:00 2001 From: aSemy <897017+aSemy@users.noreply.github.com> Date: Thu, 28 Apr 2022 18:37:23 +0200 Subject: [PATCH 1/2] #113 Spring fix paths fetch paths from patternsCondition and pathPatternsCondition --- .../converters/spring/extensions/PathsSpringExtension.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/spring/src/main/kotlin/de/codecentric/hikaku/converters/spring/extensions/PathsSpringExtension.kt b/spring/src/main/kotlin/de/codecentric/hikaku/converters/spring/extensions/PathsSpringExtension.kt index 04c6e4de..626fa966 100644 --- a/spring/src/main/kotlin/de/codecentric/hikaku/converters/spring/extensions/PathsSpringExtension.kt +++ b/spring/src/main/kotlin/de/codecentric/hikaku/converters/spring/extensions/PathsSpringExtension.kt @@ -2,6 +2,7 @@ package de.codecentric.hikaku.converters.spring.extensions import org.springframework.web.servlet.mvc.method.RequestMappingInfo -internal fun RequestMappingInfo.paths(): Set { - return this.patternsCondition?.patterns ?: emptySet() +internal fun RequestMappingInfo.paths(): Set = buildSet { + patternsCondition?.patterns?.let(::addAll) + pathPatternsCondition?.patterns?.map { it.patternString }?.let(::addAll) } From baff6a3ba4804315d82bc98415c79a629e9dfda1 Mon Sep 17 00:00:00 2001 From: Adam <897017+aSemy@users.noreply.github.com> Date: Thu, 28 Apr 2022 18:43:58 +0200 Subject: [PATCH 2/2] tidy up Spring paths extractor --- .../converters/spring/extensions/PathsSpringExtension.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/spring/src/main/kotlin/de/codecentric/hikaku/converters/spring/extensions/PathsSpringExtension.kt b/spring/src/main/kotlin/de/codecentric/hikaku/converters/spring/extensions/PathsSpringExtension.kt index 626fa966..a4db4579 100644 --- a/spring/src/main/kotlin/de/codecentric/hikaku/converters/spring/extensions/PathsSpringExtension.kt +++ b/spring/src/main/kotlin/de/codecentric/hikaku/converters/spring/extensions/PathsSpringExtension.kt @@ -2,7 +2,7 @@ package de.codecentric.hikaku.converters.spring.extensions import org.springframework.web.servlet.mvc.method.RequestMappingInfo -internal fun RequestMappingInfo.paths(): Set = buildSet { - patternsCondition?.patterns?.let(::addAll) - pathPatternsCondition?.patterns?.map { it.patternString }?.let(::addAll) -} +internal fun RequestMappingInfo.paths(): Set = + patternsCondition?.patterns + ?: pathPatternsCondition?.patterns?.map { it.patternString }?.toSet() + ?: emptySet()