-
-
Save zacharycarter/92c38941845c05b8b0479a6c4cedc11f 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
import asyncdispatch, httpclient | |
var client = newAsyncHttpClient() | |
let fut = withTimeout(client.getContent("https://localhost:8080"), 2500) | |
discard waitFor fut | |
echo fut.failed |
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
nim c -d:release -d:ssl http_test_server.nim | |
nim c -d:release -d:ssl http_test_client.nim | |
./http_test_server | |
./http_test_client | |
output: | |
false |
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
import options, asyncdispatch | |
import httpbeast | |
proc onRequest(req: Request): Future[void] = | |
if req.httpMethod == some(HttpGet): | |
case req.path.get() | |
of "/": | |
req.send("Hello World") | |
else: | |
req.send(Http404) | |
run(onRequest) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment