From 22b498cef33c70d584a8452ce96dfec7292488e0 Mon Sep 17 00:00:00 2001 From: David Dunn Date: Mon, 24 Sep 2018 16:46:35 +0100 Subject: [PATCH] Tidy up naming/logic --- Sources/Kitura/CodableRouter.swift | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Sources/Kitura/CodableRouter.swift b/Sources/Kitura/CodableRouter.swift index 22d37c882..b53209d4d 100644 --- a/Sources/Kitura/CodableRouter.swift +++ b/Sources/Kitura/CodableRouter.swift @@ -615,9 +615,11 @@ extension Router { case (true, true): /// Precondition: Path is known to contain a : character func pathHasSingleParamIdAsSuffix(_ path: String) -> Bool { - let parameterString = path.split(separator: ":", maxSplits: 1) - let parameter = parameterString.count > 1 ? parameterString[1] : "" - return parameter == "id" + let pathArray = path.split(separator: ":", maxSplits: 1) + if pathArray.count > 1 { + return parameter == "id" + } + return false } guard pathHasSingleParamIdAsSuffix(path) else {