Use distinct range for HttpCode as suggested by @nigredo-tori.

This commit is contained in:
Dominik Picheta 2016-09-19 20:58:27 +02:00
commit cfd187d16e
3 changed files with 121 additions and 55 deletions

View file

@ -93,12 +93,13 @@ type
headers*: HttpHeaders
body*: string
proc code*(response: Response): HttpCode {.raises: [ValueError].} =
proc code*(response: Response): HttpCode
{.raises: [ValueError, OverflowError].} =
## Retrieves the specified response's ``HttpCode``.
##
## Raises a ``ValueError`` if the response's ``status`` does not have a
## corresponding ``HttpCode``.
return parseEnum[HttpCode](response.status)
return response.status[0 .. 2].parseInt.HttpCode
type
Proxy* = ref object