mirror of
https://github.com/gin-gonic/gin.git
synced 2025-12-13 13:12:17 +08:00
chore: fixed golangci-lint issue in test cases for literal colon
This commit is contained in:
parent
1092232f44
commit
22d8cd6570
@ -19,7 +19,8 @@ func TestLiteralColonWithRun(t *testing.T) {
|
|||||||
router.updateRouteTrees()
|
router.updateRouteTrees()
|
||||||
|
|
||||||
w := httptest.NewRecorder()
|
w := httptest.NewRecorder()
|
||||||
req, _ := http.NewRequest("GET", "/test:action", nil)
|
|
||||||
|
req, _ := http.NewRequest(http.MethodGet, "/test:action", nil)
|
||||||
router.ServeHTTP(w, req)
|
router.ServeHTTP(w, req)
|
||||||
|
|
||||||
assert.Equal(t, http.StatusOK, w.Code)
|
assert.Equal(t, http.StatusOK, w.Code)
|
||||||
@ -35,7 +36,7 @@ func TestLiteralColonWithDirectServeHTTP(t *testing.T) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
w := httptest.NewRecorder()
|
w := httptest.NewRecorder()
|
||||||
req, _ := http.NewRequest("GET", "/test:action", nil)
|
req, _ := http.NewRequest(http.MethodGet, "/test:action", nil)
|
||||||
router.ServeHTTP(w, req)
|
router.ServeHTTP(w, req)
|
||||||
|
|
||||||
assert.Equal(t, http.StatusOK, w.Code)
|
assert.Equal(t, http.StatusOK, w.Code)
|
||||||
@ -54,7 +55,7 @@ func TestLiteralColonWithHandler(t *testing.T) {
|
|||||||
handler := router.Handler()
|
handler := router.Handler()
|
||||||
|
|
||||||
w := httptest.NewRecorder()
|
w := httptest.NewRecorder()
|
||||||
req, _ := http.NewRequest("GET", "/test:action", nil)
|
req, _ := http.NewRequest(http.MethodGet, "/test:action", nil)
|
||||||
handler.ServeHTTP(w, req)
|
handler.ServeHTTP(w, req)
|
||||||
|
|
||||||
assert.Equal(t, http.StatusOK, w.Code)
|
assert.Equal(t, http.StatusOK, w.Code)
|
||||||
@ -74,14 +75,14 @@ func TestLiteralColonWithHTTPServer(t *testing.T) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
w := httptest.NewRecorder()
|
w := httptest.NewRecorder()
|
||||||
req, _ := http.NewRequest("GET", "/test:action", nil)
|
req, _ := http.NewRequest(http.MethodGet, "/test:action", nil)
|
||||||
router.ServeHTTP(w, req)
|
router.ServeHTTP(w, req)
|
||||||
|
|
||||||
assert.Equal(t, http.StatusOK, w.Code)
|
assert.Equal(t, http.StatusOK, w.Code)
|
||||||
assert.Contains(t, w.Body.String(), "literal_colon")
|
assert.Contains(t, w.Body.String(), "literal_colon")
|
||||||
|
|
||||||
w2 := httptest.NewRecorder()
|
w2 := httptest.NewRecorder()
|
||||||
req2, _ := http.NewRequest("GET", "/test/foo", nil)
|
req2, _ := http.NewRequest(http.MethodGet, "/test/foo", nil)
|
||||||
router.ServeHTTP(w2, req2)
|
router.ServeHTTP(w2, req2)
|
||||||
|
|
||||||
assert.Equal(t, http.StatusOK, w2.Code)
|
assert.Equal(t, http.StatusOK, w2.Code)
|
||||||
@ -102,7 +103,7 @@ func TestUpdateRouteTreesCalledOnce(t *testing.T) {
|
|||||||
|
|
||||||
for i := 0; i < 5; i++ {
|
for i := 0; i < 5; i++ {
|
||||||
w := httptest.NewRecorder()
|
w := httptest.NewRecorder()
|
||||||
req, _ := http.NewRequest("GET", "/test:action", nil)
|
req, _ := http.NewRequest(http.MethodGet, "/test:action", nil)
|
||||||
router.ServeHTTP(w, req)
|
router.ServeHTTP(w, req)
|
||||||
assert.Equal(t, http.StatusOK, w.Code)
|
assert.Equal(t, http.StatusOK, w.Code)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user