@@ -5936,17 +5936,17 @@ func Test_Ctx_End(t *testing.T) {
5936
5936
app := New ()
5937
5937
5938
5938
app .Get ("/" , func (c Ctx ) error {
5939
- c .SendString ("Hello, World!" )
5939
+ c .SendString ("Hello, World!" ) //nolint:errcheck // unnecessary to check error
5940
5940
return c .End ()
5941
5941
})
5942
5942
5943
5943
resp , err := app .Test (httptest .NewRequest (MethodGet , "/" , nil ))
5944
5944
require .NoError (t , err )
5945
5945
require .NotNil (t , resp )
5946
- require .Equal (t , resp .StatusCode , 200 )
5946
+ require .Equal (t , 200 , resp .StatusCode )
5947
5947
body , err := io .ReadAll (resp .Body )
5948
5948
require .NoError (t , err , "io.ReadAll(resp.Body)" )
5949
- require .Equal (t , string ( body ), "Hello, World!" )
5949
+ require .Equal (t , "Hello, World!" , string ( body ) )
5950
5950
}
5951
5951
5952
5952
// go test -run Test_Ctx_End_with_drop_middleware
@@ -5956,20 +5956,20 @@ func Test_Ctx_End_with_drop_middleware(t *testing.T) {
5956
5956
// Middleware that will drop connections
5957
5957
// that persist after c.Next()
5958
5958
app .Use (func (c Ctx ) error {
5959
- c .Next ()
5959
+ c .Next () //nolint:errcheck // unnecessary to check error
5960
5960
return c .Drop ()
5961
5961
})
5962
5962
5963
5963
// Early flushing handler
5964
5964
app .Get ("/" , func (c Ctx ) error {
5965
- c .SendStatus (StatusOK )
5965
+ c .SendStatus (StatusOK ) //nolint:errcheck // unnecessary to check error
5966
5966
return c .End ()
5967
5967
})
5968
5968
5969
5969
resp , err := app .Test (httptest .NewRequest (MethodGet , "/" , nil ))
5970
5970
require .NoError (t , err )
5971
5971
require .NotNil (t , resp )
5972
- require .Equal (t , resp .StatusCode , 200 )
5972
+ require .Equal (t , 200 , resp .StatusCode )
5973
5973
}
5974
5974
5975
5975
// go test -run Test_Ctx_End_after_drop
@@ -5989,7 +5989,7 @@ func Test_Ctx_End_after_drop(t *testing.T) {
5989
5989
})
5990
5990
5991
5991
resp , err := app .Test (httptest .NewRequest (MethodGet , "/" , nil ))
5992
- require .Error (t , err )
5992
+ require .ErrorIs (t , err , ErrTestGotEmptyResponse )
5993
5993
require .Nil (t , resp )
5994
5994
}
5995
5995
0 commit comments