Created
April 13, 2018 15:48
-
-
Save kgilmer/4897c5ff1cfdada62b485bc93d9f0ce3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun fetchFileOrNull(exchange: HttpExchange, basePath: File): File? = | |
when (validRequest(exchange)) { | |
true -> { | |
val resource = localFileFromRequestUri(basePath, exchange.requestURI) | |
print("Seeking ${resource.absolutePath}...") | |
if (resource.isFile) resource else null | |
} | |
false -> null | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment