Skip to content
This repository has been archived by the owner on Aug 10, 2024. It is now read-only.

Commit

Permalink
a bit more work on routing, almost there, a few unit tests to fix and…
Browse files Browse the repository at this point in the history
… docs to write
  • Loading branch information
sanity committed Apr 15, 2017
1 parent 69aabc0 commit 4104185
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/kotlin/io/kweb/routing/UrlPathParser.kt
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ internal sealed class ParsingResult {
}

fun Any.toPath(): String {
val entityPath = javaClass.simpleName.toLowerCase().takeUnless { it == "root" }?.let { "/$it" } ?: ""
val entityPath = javaClass.simpleName.toLowerCase().takeUnless { it == "root" }?.let { "/$it" } ?: "/"
val members = javaClass.kotlin.members
val params = javaClass.kotlin.primaryConstructor?.parameters?.joinToString(separator = "") { parameter ->
val value = members.find { it.name == parameter.name }?.call(this)
Expand All @@ -158,5 +158,5 @@ fun Any.toPath(): String {
}
"/${convertedValue ?: ""}"
} ?: throw IllegalArgumentException("No primary constructor found")
return "$entityPath$params"
gi return "$entityPath$params"
}

0 comments on commit 4104185

Please sign in to comment.