Created
April 13, 2018 15:47
-
-
Save kgilmer/839c81415eb36065ab7dc4dd647672d1 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