This commit is contained in:
Andreas Rumpf 2017-03-27 09:39:46 +02:00 • committed by GitHub
commit 159643824b
4 changed files with 36 additions and 29 deletions

View file

@ -285,7 +285,7 @@ proc `$`*(code: HttpCode): string =
proc `==`*(a, b: HttpCode): bool {.borrow.}
proc `==`*(rawCode: string, code: HttpCode): bool =
return rawCode.toLower() == ($code).toLower()
return cmpIgnoreCase(rawCode, $code) == 0
proc is2xx*(code: HttpCode): bool =
## Determines whether ``code`` is a 2xx HTTP status code.
@ -304,7 +304,7 @@ proc is5xx*(code: HttpCode): bool =
return code.int in {500 .. 599}
proc `$`*(httpMethod: HttpMethod): string =
return (system.`$`(httpMethod))[4 .. ^1].toUpper()
return (system.`$`(httpMethod))[4 .. ^1].toUpperAscii()
when isMainModule:
var test = newHttpHeaders()