Skip to content

Commit

Permalink
Detect 308 as redirect status code
Browse files Browse the repository at this point in the history
Same as net/http does.
  • Loading branch information
erikdubbelboer committed Jan 19, 2019
1 parent c88be72 commit c3ff460
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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).
//
Expand Down Expand Up @@ -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).
//
Expand All @@ -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
Expand Down

0 comments on commit c3ff460

Please sign in to comment.