Update the readme instruction to test the server.

This commit is contained in:
Arijit Das 2020-12-08 15:45:21 +05:30
parent d4901f1cba
commit a1c1c37a41
2 changed files with 10 additions and 14 deletions

View File

@ -1,4 +1,4 @@
Websocket for Nim
# Websocket for Nim
We're working towards an implementation of the
[Websocket](https://tools.ietf.org/html/rfc6455) protocol for
@ -14,8 +14,14 @@ Install dependencies:
nimble install -d
```
Run tests:
Starting HTTP server:
```bash
nimble test
nim c -r test/server.nim
```
Testing Server Response:
```bash
curl --location --request GET 'http://localhost:8888'
```

View File

@ -63,17 +63,7 @@ proc validateRequest(transp: StreamTransport,
result = ErrorFailure
return
let length = header.contentLength()
if length <= 0:
# request length could not be calculated.
debug "Content-Length is missing or 0", address = transp.remoteAddress()
if await transp.sendHTTPResponse(header.version, Http411):
result = Error
else:
result = ErrorFailure
return
if length > MaxHttpRequestSize:
if header.contentLength() > MaxHttpRequestSize:
# request length is more then `MaxHttpRequestSize`.
debug "Maximum size of request body reached",
address = transp.remoteAddress()