@@ -180,58 +180,58 @@ func TestRouteRedirectTrailingSlash(t *testing.T) {
180180
181181 w = PerformRequest (router , http .MethodGet , "/path2" , header {Key : "X-Forwarded-Prefix" , Value : "/api" })
182182 assert .Equal (t , "/api/path2/" , w .Header ().Get ("Location" ))
183- assert .Equal (t , 301 , w .Code )
183+ assert .Equal (t , http . StatusMovedPermanently , w .Code )
184184
185185 w = PerformRequest (router , http .MethodGet , "/path2/" , header {Key : "X-Forwarded-Prefix" , Value : "/api/" })
186- assert .Equal (t , 200 , w .Code )
186+ assert .Equal (t , http . StatusOK , w .Code )
187187
188188 w = PerformRequest (router , http .MethodGet , "/path/" , header {Key : "X-Forwarded-Prefix" , Value : "../../api#?" })
189189 assert .Equal (t , "/api/path" , w .Header ().Get ("Location" ))
190- assert .Equal (t , 301 , w .Code )
190+ assert .Equal (t , http . StatusMovedPermanently , w .Code )
191191
192192 w = PerformRequest (router , http .MethodGet , "/path/" , header {Key : "X-Forwarded-Prefix" , Value : "../../api" })
193193 assert .Equal (t , "/api/path" , w .Header ().Get ("Location" ))
194- assert .Equal (t , 301 , w .Code )
194+ assert .Equal (t , http . StatusMovedPermanently , w .Code )
195195
196196 w = PerformRequest (router , http .MethodGet , "/path2" , header {Key : "X-Forwarded-Prefix" , Value : "../../api" })
197197 assert .Equal (t , "/api/path2/" , w .Header ().Get ("Location" ))
198- assert .Equal (t , 301 , w .Code )
198+ assert .Equal (t , http . StatusMovedPermanently , w .Code )
199199
200200 w = PerformRequest (router , http .MethodGet , "/path2" , header {Key : "X-Forwarded-Prefix" , Value : "/../../api" })
201201 assert .Equal (t , "/api/path2/" , w .Header ().Get ("Location" ))
202- assert .Equal (t , 301 , w .Code )
202+ assert .Equal (t , http . StatusMovedPermanently , w .Code )
203203
204204 w = PerformRequest (router , http .MethodGet , "/path/" , header {Key : "X-Forwarded-Prefix" , Value : "api/../../" })
205205 assert .Equal (t , "//path" , w .Header ().Get ("Location" ))
206- assert .Equal (t , 301 , w .Code )
206+ assert .Equal (t , http . StatusMovedPermanently , w .Code )
207207
208208 w = PerformRequest (router , http .MethodGet , "/path/" , header {Key : "X-Forwarded-Prefix" , Value : "api/../../../" })
209209 assert .Equal (t , "/path" , w .Header ().Get ("Location" ))
210- assert .Equal (t , 301 , w .Code )
210+ assert .Equal (t , http . StatusMovedPermanently , w .Code )
211211
212212 w = PerformRequest (router , http .MethodGet , "/path2" , header {Key : "X-Forwarded-Prefix" , Value : "../../gin-gonic.com" })
213213 assert .Equal (t , "/gin-goniccom/path2/" , w .Header ().Get ("Location" ))
214- assert .Equal (t , 301 , w .Code )
214+ assert .Equal (t , http . StatusMovedPermanently , w .Code )
215215
216216 w = PerformRequest (router , http .MethodGet , "/path2" , header {Key : "X-Forwarded-Prefix" , Value : "/../../gin-gonic.com" })
217217 assert .Equal (t , "/gin-goniccom/path2/" , w .Header ().Get ("Location" ))
218- assert .Equal (t , 301 , w .Code )
218+ assert .Equal (t , http . StatusMovedPermanently , w .Code )
219219
220220 w = PerformRequest (router , http .MethodGet , "/path/" , header {Key : "X-Forwarded-Prefix" , Value : "https://gin-gonic.com/#" })
221221 assert .Equal (t , "https/gin-goniccom/https/gin-goniccom/path" , w .Header ().Get ("Location" ))
222- assert .Equal (t , 301 , w .Code )
222+ assert .Equal (t , http . StatusMovedPermanently , w .Code )
223223
224224 w = PerformRequest (router , http .MethodGet , "/path/" , header {Key : "X-Forwarded-Prefix" , Value : "#api" })
225225 assert .Equal (t , "api/api/path" , w .Header ().Get ("Location" ))
226- assert .Equal (t , 301 , w .Code )
226+ assert .Equal (t , http . StatusMovedPermanently , w .Code )
227227
228228 w = PerformRequest (router , http .MethodGet , "/path/" , header {Key : "X-Forwarded-Prefix" , Value : "/nor-mal/#?a=1" })
229229 assert .Equal (t , "/nor-mal/a1/path" , w .Header ().Get ("Location" ))
230- assert .Equal (t , 301 , w .Code )
230+ assert .Equal (t , http . StatusMovedPermanently , w .Code )
231231
232232 w = PerformRequest (router , http .MethodGet , "/path/" , header {Key : "X-Forwarded-Prefix" , Value : "/nor-mal/%2e%2e/" })
233233 assert .Equal (t , "/nor-mal/2e2e/path" , w .Header ().Get ("Location" ))
234- assert .Equal (t , 301 , w .Code )
234+ assert .Equal (t , http . StatusMovedPermanently , w .Code )
235235
236236 router .RedirectTrailingSlash = false
237237
@@ -619,11 +619,11 @@ func TestRouterNotFound(t *testing.T) {
619619 router = New ()
620620 router .NoRoute (func (c * Context ) {
621621 if c .Request .RequestURI == "/login" {
622- c .String (200 , "login" )
622+ c .String (http . StatusOK , "login" )
623623 }
624624 })
625625 router .GET ("/logout" , func (c * Context ) {
626- c .String (200 , "logout" )
626+ c .String (http . StatusOK , "logout" )
627627 })
628628 w = PerformRequest (router , http .MethodGet , "/login" )
629629 assert .Equal (t , "login" , w .Body .String ())
@@ -635,7 +635,7 @@ func TestRouterStaticFSNotFound(t *testing.T) {
635635 router := New ()
636636 router .StaticFS ("/" , http .FileSystem (http .Dir ("/thisreallydoesntexist/" )))
637637 router .NoRoute (func (c * Context ) {
638- c .String (404 , "non existent" )
638+ c .String (http . StatusNotFound , "non existent" )
639639 })
640640
641641 w := PerformRequest (router , http .MethodGet , "/nonexistent" )
@@ -718,12 +718,12 @@ func TestRouteRawPathNoUnescape(t *testing.T) {
718718func TestRouteServeErrorWithWriteHeader (t * testing.T ) {
719719 route := New ()
720720 route .Use (func (c * Context ) {
721- c .Status (421 )
721+ c .Status (http . StatusMisdirectedRequest )
722722 c .Next ()
723723 })
724724
725725 w := PerformRequest (route , http .MethodGet , "/NotFound" )
726- assert .Equal (t , 421 , w .Code )
726+ assert .Equal (t , http . StatusMisdirectedRequest , w .Code )
727727 assert .Equal (t , 0 , w .Body .Len ())
728728}
729729
0 commit comments