Skip to content

Commit d0a932a

Browse files
committed
Simplify HexagonCallContext.queryParameters()
1 parent b0cec47 commit d0a932a

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

oauth2-server-hexagon/src/main/java/nl/myndocs/oauth2/hexagon/request/HexagonCallContext.kt

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,17 @@ class HexagonCallContext(val call: Call) : CallContext {
1313
.mapValues { it.value.joinToString(";") }
1414

1515
override val queryParameters: Map<String, String> = (call.request
16-
.runCatching { queryString }
17-
.getOrNull() ?: "")
18-
.split("&")
19-
.filter { it.contains("=") }
20-
.map {
21-
val (key, value) = it.split("=")
22-
Pair(
23-
key.toLowerCase(),
24-
URLDecoder.decode(value, StandardCharsets.UTF_8.name())
25-
)
26-
}
27-
.toMap()
16+
.runCatching { queryString }
17+
.getOrNull() ?: "")
18+
.split("&")
19+
.filter { it.contains("=") }
20+
.associate {
21+
val (key, value) = it.split("=")
22+
Pair(
23+
key.toLowerCase(),
24+
URLDecoder.decode(value, StandardCharsets.UTF_8.name())
25+
)
26+
}
2827

2928
override val formParameters: Map<String, String> = call.parameters
3029
.mapValues { it.value.lastOrNull() }

0 commit comments

Comments
 (0)