Fix incorrect 400 reply in asynchttpserver

Without the ``continue`` the user's callback will be called but the client would have already been replied to.
This commit is contained in:
Dominik Picheta 2015-06-03 18:48:55 +01:00
commit a385b6736c

View file

@ -210,6 +210,7 @@ proc processClient(client: AsyncSocket, address: string,
var contentLength = 0 var contentLength = 0
if parseInt(request.headers["Content-Length"], contentLength) == 0: if parseInt(request.headers["Content-Length"], contentLength) == 0:
await request.respond(Http400, "Bad Request. Invalid Content-Length.") await request.respond(Http400, "Bad Request. Invalid Content-Length.")
continue
else: else:
request.body = await client.recv(contentLength) request.body = await client.recv(contentLength)
assert request.body.len == contentLength assert request.body.len == contentLength