chore: use http.Status* instead of hard code (#1482)
This commit is contained in:
@@ -16,6 +16,8 @@ type Redirect struct {
|
||||
}
|
||||
|
||||
func (r Redirect) Render(w http.ResponseWriter) error {
|
||||
// todo(thinkerou): go1.6 not support StatusPermanentRedirect(308)
|
||||
// when we upgrade go version we can use http.StatusPermanentRedirect
|
||||
if (r.Code < 300 || r.Code > 308) && r.Code != 201 {
|
||||
panic(fmt.Sprintf("Cannot redirect with status code %d", r.Code))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user