Fix tests.

This commit is contained in:
cheatfate 2021-02-21 17:34:55 +02:00
parent d595e0dbc6
commit d6a39e46e1
No known key found for this signature in database
GPG Key ID: 46ADD633A7201F95
2 changed files with 9 additions and 1 deletions

View File

@ -1046,6 +1046,14 @@ proc respond*(req: HttpRequestRef, code: HttpCode, content: string,
await response.sendBody(content)
return response
proc remoteAddress*(conn: HttpConnectionRef): TransportAddress =
## Returns address of the remote host that established connection ``conn``.
conn.transp.remoteAddress()
proc remoteAddress*(request: HttpRequestRef): TransportAddress =
## Returns address of the remote host that made request ``request``.
request.connection.remoteAddress()
proc requestInfo*(req: HttpRequestRef, contentType = "text/text"): string {.
raises: [Defect].} =
## Returns comprehensive information about request for specific content

View File

@ -262,7 +262,7 @@ suite "HTTP server testing suite":
let data = await httpClient(address, "GET / HTTP/1.1\r\n\r\n")
await server.stop()
await server.closeWait()
return serverRes and (data.startsWith("HTTP/1.1 413"))
return serverRes and (data.startsWith("HTTP/1.1 431"))
check waitFor(testTooBig(initTAddress("127.0.0.1:30080"))) == true