fix: timeout not working if greater than global rest timeout (#2926)

This commit is contained in:
Kevin Wan
2023-02-26 20:22:20 +08:00
committed by GitHub
parent ace125f189
commit 238c830f17
2 changed files with 23 additions and 6 deletions

View File

@@ -43,6 +43,7 @@ Verbose: true
Path: "/",
Handler: func(w http.ResponseWriter, r *http.Request) {},
}},
timeout: time.Minute,
},
{
priority: true,
@@ -53,6 +54,7 @@ Verbose: true
Path: "/",
Handler: func(w http.ResponseWriter, r *http.Request) {},
}},
timeout: time.Second,
},
{
priority: true,
@@ -159,6 +161,11 @@ Verbose: true
}
})
assert.NotNil(t, ng.start(mockedRouter{}))
timeout := time.Second * 3
if route.timeout > timeout {
timeout = route.timeout
}
assert.Equal(t, timeout, ng.timeout)
}
}
}