Created
April 13, 2018 15:50
-
-
Save kgilmer/8734e5680a94fdd246f5ca513ab6c808 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 -> { | |
localFileFromRequestUri(basePath, exchange.requestURI).let { requestedFile -> | |
if (requestedFile.isFile) requestedFile else null | |
} | |
} | |
false -> null | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment