File tree 2 files changed +2
-1
lines changed
2 files changed +2
-1
lines changed Original file line number Diff line number Diff line change @@ -305,7 +305,7 @@ proc contentLength*(response: Response | AsyncResponse): int =
305
305
# #
306
306
# # A `ValueError` exception will be raised if the value is not an integer.
307
307
# # If the Content-Length header is not set in the response, ContentLength is set to the value -1.
308
- var contentLengthHeader = response.headers.getOrDefault (" Content-Length" , @ [" -1" ])
308
+ var contentLengthHeader = response.headers.getOrDefault (" Content-Length" , HttpHeaderValues ( @ [" -1" ]) )
309
309
result = contentLengthHeader.parseInt ()
310
310
311
311
proc lastModified * (response: Response | AsyncResponse ): DateTime =
Original file line number Diff line number Diff line change @@ -109,6 +109,7 @@ proc testCustomContentLength() {.async.} =
109
109
doAssert (body == " " )
110
110
doAssert (response.headers.hasKey (" Content-Length" ))
111
111
doAssert (response.headers[" Content-Length" ] == " 0" )
112
+ doAssert contentLength (response) == 0 # bug #22778
112
113
113
114
runTest (handler, request, test)
114
115
You can’t perform that action at this time.
0 commit comments