httpcore: Add http code 308 Permanent Redirect (#14639)

* httpcore: Add http code 308
* httpclient: Add 308 to redirection proc
* fix typo
This commit is contained in:
djazz
2020-06-12 10:16:38 +02:00
committed by GitHub
parent 67d34366dc
commit 1168c75381
2 changed files with 3 additions and 1 deletions

View File

@@ -457,7 +457,7 @@ proc sendFile(socket: Socket | AsyncSocket,
file.close()
proc redirection(status: string): bool =
const redirectionNRs = ["301", "302", "303", "307"]
const redirectionNRs = ["301", "302", "303", "307", "308"]
for i in items(redirectionNRs):
if status.startsWith(i):
return true

View File

@@ -66,6 +66,7 @@ const
Http304* = HttpCode(304)
Http305* = HttpCode(305)
Http307* = HttpCode(307)
Http308* = HttpCode(308)
Http400* = HttpCode(400)
Http401* = HttpCode(401)
Http403* = HttpCode(403)
@@ -272,6 +273,7 @@ proc `$`*(code: HttpCode): string =
of 304: "304 Not Modified"
of 305: "305 Use Proxy"
of 307: "307 Temporary Redirect"
of 308: "308 Permanent Redirect"
of 400: "400 Bad Request"
of 401: "401 Unauthorized"
of 403: "403 Forbidden"