@@ -22,8 +22,7 @@ func getTestHandler(statusCode int) echo.HandlerFunc {
22
22
}
23
23
24
24
func TestMiddlewareIntegration (t * testing.T ) {
25
- tests := []struct {
26
- name string
25
+ tests := map [string ]struct {
27
26
handlerID string
28
27
statusCode int
29
28
req * http.Request
@@ -33,8 +32,7 @@ func TestMiddlewareIntegration(t *testing.T) {
33
32
expMethod string
34
33
expStatusCode string
35
34
}{
36
- {
37
- name : "A default HTTP middleware should call the recorder to measure." ,
35
+ "A default HTTP middleware should call the recorder to measure." : {
38
36
statusCode : http .StatusAccepted ,
39
37
req : httptest .NewRequest (http .MethodPost , "/test" , nil ),
40
38
expHandlerID : "/test" ,
@@ -43,8 +41,8 @@ func TestMiddlewareIntegration(t *testing.T) {
43
41
},
44
42
}
45
43
46
- for _ , test := range tests {
47
- t .Run (test . name , func (t * testing.T ) {
44
+ for name , test := range tests {
45
+ t .Run (name , func (t * testing.T ) {
48
46
assert := assert .New (t )
49
47
50
48
// Mocks.
@@ -67,7 +65,7 @@ func TestMiddlewareIntegration(t *testing.T) {
67
65
// Create our echo instance with the middleware.
68
66
mdlw := middleware .New (middleware.Config {Recorder : mr })
69
67
e := echo .New ()
70
- e .POST ("/test" , getTestHandler (test .statusCode ), echoMiddleware .Handler ("" , mdlw ))
68
+ e .POST ("/test" , getTestHandler (test .statusCode ), echoMiddleware .Measure ("" , mdlw ))
71
69
72
70
// Make the request.
73
71
resp := httptest .NewRecorder ()
0 commit comments