Skip to content

Commit

Permalink
feat(http): add pathParams to Call
Browse files Browse the repository at this point in the history
  • Loading branch information
LizAinslie committed Nov 2, 2024
1 parent c49da2e commit 89bcf16
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ abstract class Call(
val method: HttpMethod,
val route: Route
) {
val pathParams: Map<String, String> = TODO()
val pathParams: Map<String, String> = route.path.parts.zip(uri.path.parts).mapNotNull { (routePart, uriPart) ->
if (routePart.startsWith("{") && routePart.endsWith("}")) {
routePart.substring(1, routePart.length - 1) to uriPart
} else null
}.toMap()
val queryParams by uri.queryParam

suspend fun handle() {
Expand Down

0 comments on commit 89bcf16

Please sign in to comment.