From c3ff460e022250ee13136d0d5c8fe93dec1ef80a Mon Sep 17 00:00:00 2001 From: Erik Dubbelboer Date: Sat, 19 Jan 2019 15:12:48 +0100 Subject: [PATCH] Detect 308 as redirect status code Same as net/http does. --- server.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/server.go b/server.go index 1f87d723f0..02034496cf 100644 --- a/server.go +++ b/server.go @@ -1026,6 +1026,7 @@ func (ctx *RequestCtx) SuccessString(contentType, body string) { // * StatusFound (302) // * StatusSeeOther (303) // * StatusTemporaryRedirect (307) +// * StatusPermanentRedirect (308) // // All other statusCode values are replaced by StatusFound (302). // @@ -1054,6 +1055,7 @@ func (ctx *RequestCtx) Redirect(uri string, statusCode int) { // * StatusFound (302) // * StatusSeeOther (303) // * StatusTemporaryRedirect (307) +// * StatusPermanentRedirect (308) // // All other statusCode values are replaced by StatusFound (302). // @@ -1078,7 +1080,8 @@ func (ctx *RequestCtx) redirect(uri []byte, statusCode int) { func getRedirectStatusCode(statusCode int) int { if statusCode == StatusMovedPermanently || statusCode == StatusFound || - statusCode == StatusSeeOther || statusCode == StatusTemporaryRedirect { + statusCode == StatusSeeOther || statusCode == StatusTemporaryRedirect || + statusCode == StatusPermanentRedirect { return statusCode } return StatusFound