| 1 |
// Copyright 2014 Manu Martinez-Almeida. All rights reserved. |
| 2 |
// Use of this source code is governed by a MIT style |
| 3 |
// license that can be found in the LICENSE file. |
| 4 |
|
| 5 |
package ginscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/ |
| 6 |
|
| 7 |
import ( |
| 8 |
"fmtscip-go gomod github.com/golang/go/src go1.18 fmt/" |
| 9 |
"io/ioutilscip-go gomod github.com/golang/go/src go1.18 `io/ioutil`/" |
| 10 |
"net/httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/" |
| 11 |
"net/http/httptestscip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/" |
| 12 |
"osscip-go gomod github.com/golang/go/src go1.18 os/" |
| 13 |
"path/filepathscip-go gomod github.com/golang/go/src go1.18 `path/filepath`/" |
| 14 |
"testingscip-go gomod github.com/golang/go/src go1.18 testing/" |
| 15 |
|
| 16 |
"github.com/stretchr/testify/assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/" |
| 17 |
) |
| 18 |
|
| 19 |
type headerscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/header# struct { |
| 20 |
Keyscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/header#Key. string |
| 21 |
Valuescip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/header#Value. string |
| 22 |
} |
| 23 |
|
| 24 |
// PerformRequest for testing gin router. |
| 25 |
func PerformRequestscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/PerformRequest().(r httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.Handlerscip-go gomod github.com/golang/go/src go1.18 `net/http`/Handler#, method, path string, headers ...headerscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/header#) *httptestscip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/.ResponseRecorderscip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder# { |
| 26 |
req := httptestscip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/.NewRequestscip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/NewRequest().(method, path, nil) |
| 27 |
for _, h := range headers { |
| 28 |
req.Headerscip-go gomod github.com/golang/go/src go1.18 `net/http`/Request#Header..Addscip-go gomod github.com/golang/go/src go1.18 `net/http`/Header#Add().(h.Keyscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/header#Key., h.Valuescip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/header#Value.) |
| 29 |
} |
| 30 |
w := httptestscip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/.NewRecorderscip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/NewRecorder().() |
| 31 |
r.ServeHTTPscip-go gomod github.com/golang/go/src go1.18 `net/http`/Handler#ServeHTTP().(w, req) |
| 32 |
return w |
| 33 |
} |
| 34 |
|
| 35 |
func testRouteOKscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/testRouteOK().(method string, t *testingscip-go gomod github.com/golang/go/src go1.18 testing/.Tscip-go gomod github.com/golang/go/src go1.18 testing/T#) { |
| 36 |
passed := false |
| 37 |
passedAny := false |
| 38 |
r := Newscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/New().() |
| 39 |
r.Anyscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/RouterGroup#Any().("/test2", func(c *Contextscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Context#) { |
| 40 |
passedAny = true |
| 41 |
}) |
| 42 |
r.Handlescip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/RouterGroup#Handle().(method, "/test", func(c *Contextscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Context#) { |
| 43 |
passed = true |
| 44 |
}) |
| 45 |
|
| 46 |
w := PerformRequestscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/PerformRequest().(r, method, "/test") |
| 47 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Truescip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/True().(t, passed) |
| 48 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.StatusOKscip-go gomod github.com/golang/go/src go1.18 `net/http`/StatusOK., w.Codescip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Code.) |
| 49 |
|
| 50 |
PerformRequestscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/PerformRequest().(r, method, "/test2") |
| 51 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Truescip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/True().(t, passedAny) |
| 52 |
} |
| 53 |
|
| 54 |
// TestSingleRouteOK tests that POST route is correctly invoked. |
| 55 |
func testRouteNotOKscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/testRouteNotOK().(method string, t *testingscip-go gomod github.com/golang/go/src go1.18 testing/.Tscip-go gomod github.com/golang/go/src go1.18 testing/T#) { |
| 56 |
passed := false |
| 57 |
router := Newscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/New().() |
| 58 |
router.Handlescip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/RouterGroup#Handle().(method, "/test_2", func(c *Contextscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Context#) { |
| 59 |
passed = true |
| 60 |
}) |
| 61 |
|
| 62 |
w := PerformRequestscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/PerformRequest().(router, method, "/test") |
| 63 |
|
| 64 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Falsescip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/False().(t, passed) |
| 65 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.StatusNotFoundscip-go gomod github.com/golang/go/src go1.18 `net/http`/StatusNotFound., w.Codescip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Code.) |
| 66 |
} |
| 67 |
|
| 68 |
// TestSingleRouteOK tests that POST route is correctly invoked. |
| 69 |
func testRouteNotOK2scip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/testRouteNotOK2().(method string, t *testingscip-go gomod github.com/golang/go/src go1.18 testing/.Tscip-go gomod github.com/golang/go/src go1.18 testing/T#) { |
| 70 |
passed := false |
| 71 |
router := Newscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/New().() |
| 72 |
router.HandleMethodNotAllowedscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Engine#HandleMethodNotAllowed. = true |
| 73 |
var methodRoute string |
| 74 |
if method == httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodPostscip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodPost. { |
| 75 |
methodRoute = httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodGetscip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodGet. |
| 76 |
} else { |
| 77 |
methodRoute = httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodPostscip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodPost. |
| 78 |
} |
| 79 |
router.Handlescip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/RouterGroup#Handle().(methodRoute, "/test", func(c *Contextscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Context#) { |
| 80 |
passed = true |
| 81 |
}) |
| 82 |
|
| 83 |
w := PerformRequestscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/PerformRequest().(router, method, "/test") |
| 84 |
|
| 85 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Falsescip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/False().(t, passed) |
| 86 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.StatusMethodNotAllowedscip-go gomod github.com/golang/go/src go1.18 `net/http`/StatusMethodNotAllowed., w.Codescip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Code.) |
| 87 |
} |
| 88 |
|
| 89 |
func TestRouterMethodscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/TestRouterMethod().(t *testingscip-go gomod github.com/golang/go/src go1.18 testing/.Tscip-go gomod github.com/golang/go/src go1.18 testing/T#) { |
| 90 |
router := Newscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/New().() |
| 91 |
router.PUTscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/RouterGroup#PUT().("/hey2", func(c *Contextscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Context#) { |
| 92 |
c.Stringscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Context#String().(httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.StatusOKscip-go gomod github.com/golang/go/src go1.18 `net/http`/StatusOK., "sup2") |
| 93 |
}) |
| 94 |
|
| 95 |
router.PUTscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/RouterGroup#PUT().("/hey", func(c *Contextscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Context#) { |
| 96 |
c.Stringscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Context#String().(httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.StatusOKscip-go gomod github.com/golang/go/src go1.18 `net/http`/StatusOK., "called") |
| 97 |
}) |
| 98 |
|
| 99 |
router.PUTscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/RouterGroup#PUT().("/hey3", func(c *Contextscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Context#) { |
| 100 |
c.Stringscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Context#String().(httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.StatusOKscip-go gomod github.com/golang/go/src go1.18 `net/http`/StatusOK., "sup3") |
| 101 |
}) |
| 102 |
|
| 103 |
w := PerformRequestscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/PerformRequest().(router, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodPutscip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodPut., "/hey") |
| 104 |
|
| 105 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.StatusOKscip-go gomod github.com/golang/go/src go1.18 `net/http`/StatusOK., w.Codescip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Code.) |
| 106 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, "called", w.Bodyscip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Body..Stringscip-go gomod github.com/golang/go/src go1.18 bytes/Buffer#String().()) |
| 107 |
} |
| 108 |
|
| 109 |
func TestRouterGroupRouteOKscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/TestRouterGroupRouteOK().(t *testingscip-go gomod github.com/golang/go/src go1.18 testing/.Tscip-go gomod github.com/golang/go/src go1.18 testing/T#) { |
| 110 |
testRouteOKscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/testRouteOK().(httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodGetscip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodGet., t) |
| 111 |
testRouteOKscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/testRouteOK().(httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodPostscip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodPost., t) |
| 112 |
testRouteOKscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/testRouteOK().(httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodPutscip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodPut., t) |
| 113 |
testRouteOKscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/testRouteOK().(httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodPatchscip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodPatch., t) |
| 114 |
testRouteOKscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/testRouteOK().(httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodHeadscip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodHead., t) |
| 115 |
testRouteOKscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/testRouteOK().(httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodOptionsscip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodOptions., t) |
| 116 |
testRouteOKscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/testRouteOK().(httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodDeletescip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodDelete., t) |
| 117 |
testRouteOKscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/testRouteOK().(httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodConnectscip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodConnect., t) |
| 118 |
testRouteOKscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/testRouteOK().(httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodTracescip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodTrace., t) |
| 119 |
} |
| 120 |
|
| 121 |
func TestRouteNotOKscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/TestRouteNotOK().(t *testingscip-go gomod github.com/golang/go/src go1.18 testing/.Tscip-go gomod github.com/golang/go/src go1.18 testing/T#) { |
| 122 |
testRouteNotOKscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/testRouteNotOK().(httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodGetscip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodGet., t) |
| 123 |
testRouteNotOKscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/testRouteNotOK().(httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodPostscip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodPost., t) |
| 124 |
testRouteNotOKscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/testRouteNotOK().(httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodPutscip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodPut., t) |
| 125 |
testRouteNotOKscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/testRouteNotOK().(httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodPatchscip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodPatch., t) |
| 126 |
testRouteNotOKscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/testRouteNotOK().(httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodHeadscip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodHead., t) |
| 127 |
testRouteNotOKscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/testRouteNotOK().(httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodOptionsscip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodOptions., t) |
| 128 |
testRouteNotOKscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/testRouteNotOK().(httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodDeletescip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodDelete., t) |
| 129 |
testRouteNotOKscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/testRouteNotOK().(httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodConnectscip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodConnect., t) |
| 130 |
testRouteNotOKscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/testRouteNotOK().(httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodTracescip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodTrace., t) |
| 131 |
} |
| 132 |
|
| 133 |
func TestRouteNotOK2scip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/TestRouteNotOK2().(t *testingscip-go gomod github.com/golang/go/src go1.18 testing/.Tscip-go gomod github.com/golang/go/src go1.18 testing/T#) { |
| 134 |
testRouteNotOK2scip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/testRouteNotOK2().(httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodGetscip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodGet., t) |
| 135 |
testRouteNotOK2scip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/testRouteNotOK2().(httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodPostscip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodPost., t) |
| 136 |
testRouteNotOK2scip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/testRouteNotOK2().(httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodPutscip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodPut., t) |
| 137 |
testRouteNotOK2scip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/testRouteNotOK2().(httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodPatchscip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodPatch., t) |
| 138 |
testRouteNotOK2scip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/testRouteNotOK2().(httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodHeadscip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodHead., t) |
| 139 |
testRouteNotOK2scip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/testRouteNotOK2().(httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodOptionsscip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodOptions., t) |
| 140 |
testRouteNotOK2scip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/testRouteNotOK2().(httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodDeletescip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodDelete., t) |
| 141 |
testRouteNotOK2scip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/testRouteNotOK2().(httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodConnectscip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodConnect., t) |
| 142 |
testRouteNotOK2scip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/testRouteNotOK2().(httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodTracescip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodTrace., t) |
| 143 |
} |
| 144 |
|
| 145 |
func TestRouteRedirectTrailingSlashscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/TestRouteRedirectTrailingSlash().(t *testingscip-go gomod github.com/golang/go/src go1.18 testing/.Tscip-go gomod github.com/golang/go/src go1.18 testing/T#) { |
| 146 |
router := Newscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/New().() |
| 147 |
router.RedirectFixedPathscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Engine#RedirectFixedPath. = false |
| 148 |
router.RedirectTrailingSlashscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Engine#RedirectTrailingSlash. = true |
| 149 |
router.GETscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/RouterGroup#GET().("/path", func(c *Contextscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Context#) {}) |
| 150 |
router.GETscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/RouterGroup#GET().("/path2/", func(c *Contextscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Context#) {}) |
| 151 |
router.POSTscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/RouterGroup#POST().("/path3", func(c *Contextscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Context#) {}) |
| 152 |
router.PUTscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/RouterGroup#PUT().("/path4/", func(c *Contextscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Context#) {}) |
| 153 |
|
| 154 |
w := PerformRequestscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/PerformRequest().(router, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodGetscip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodGet., "/path/") |
| 155 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, "/path", w.Headerscip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Header().().Getscip-go gomod github.com/golang/go/src go1.18 `net/http`/Header#Get().("Location")) |
| 156 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.StatusMovedPermanentlyscip-go gomod github.com/golang/go/src go1.18 `net/http`/StatusMovedPermanently., w.Codescip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Code.) |
| 157 |
|
| 158 |
w = PerformRequestscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/PerformRequest().(router, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodGetscip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodGet., "/path2") |
| 159 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, "/path2/", w.Headerscip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Header().().Getscip-go gomod github.com/golang/go/src go1.18 `net/http`/Header#Get().("Location")) |
| 160 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.StatusMovedPermanentlyscip-go gomod github.com/golang/go/src go1.18 `net/http`/StatusMovedPermanently., w.Codescip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Code.) |
| 161 |
|
| 162 |
w = PerformRequestscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/PerformRequest().(router, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodPostscip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodPost., "/path3/") |
| 163 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, "/path3", w.Headerscip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Header().().Getscip-go gomod github.com/golang/go/src go1.18 `net/http`/Header#Get().("Location")) |
| 164 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.StatusTemporaryRedirectscip-go gomod github.com/golang/go/src go1.18 `net/http`/StatusTemporaryRedirect., w.Codescip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Code.) |
| 165 |
|
| 166 |
w = PerformRequestscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/PerformRequest().(router, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodPutscip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodPut., "/path4") |
| 167 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, "/path4/", w.Headerscip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Header().().Getscip-go gomod github.com/golang/go/src go1.18 `net/http`/Header#Get().("Location")) |
| 168 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.StatusTemporaryRedirectscip-go gomod github.com/golang/go/src go1.18 `net/http`/StatusTemporaryRedirect., w.Codescip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Code.) |
| 169 |
|
| 170 |
w = PerformRequestscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/PerformRequest().(router, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodGetscip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodGet., "/path") |
| 171 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.StatusOKscip-go gomod github.com/golang/go/src go1.18 `net/http`/StatusOK., w.Codescip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Code.) |
| 172 |
|
| 173 |
w = PerformRequestscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/PerformRequest().(router, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodGetscip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodGet., "/path2/") |
| 174 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.StatusOKscip-go gomod github.com/golang/go/src go1.18 `net/http`/StatusOK., w.Codescip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Code.) |
| 175 |
|
| 176 |
w = PerformRequestscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/PerformRequest().(router, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodPostscip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodPost., "/path3") |
| 177 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.StatusOKscip-go gomod github.com/golang/go/src go1.18 `net/http`/StatusOK., w.Codescip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Code.) |
| 178 |
|
| 179 |
w = PerformRequestscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/PerformRequest().(router, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodPutscip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodPut., "/path4/") |
| 180 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.StatusOKscip-go gomod github.com/golang/go/src go1.18 `net/http`/StatusOK., w.Codescip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Code.) |
| 181 |
|
| 182 |
w = PerformRequestscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/PerformRequest().(router, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodGetscip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodGet., "/path2", headerscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/header#{Keyscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/header#Key.: "X-Forwarded-Prefix", Valuescip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/header#Value.: "/api"}) |
| 183 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, "/api/path2/", w.Headerscip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Header().().Getscip-go gomod github.com/golang/go/src go1.18 `net/http`/Header#Get().("Location")) |
| 184 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, 301, w.Codescip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Code.) |
| 185 |
|
| 186 |
w = PerformRequestscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/PerformRequest().(router, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodGetscip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodGet., "/path2/", headerscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/header#{Keyscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/header#Key.: "X-Forwarded-Prefix", Valuescip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/header#Value.: "/api/"}) |
| 187 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, 200, w.Codescip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Code.) |
| 188 |
|
| •189 |
w = PerformRequestscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/PerformRequest().(router, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodGetscip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodGet., "/path/", headerscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/header#{Keyscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/header#Key.: "X-Forwarded-Prefix", Valuescip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/header#Value.: "../../api#?"}) |
| 190 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, "/api/path", w.Headerscip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Header().().Getscip-go gomod github.com/golang/go/src go1.18 `net/http`/Header#Get().("Location")) |
| 191 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, 301, w.Codescip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Code.) |
| 192 |
|
| 193 |
w = PerformRequestscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/PerformRequest().(router, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodGetscip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodGet., "/path/", headerscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/header#{Keyscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/header#Key.: "X-Forwarded-Prefix", Valuescip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/header#Value.: "../../api"}) |
| 194 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, "/api/path", w.Headerscip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Header().().Getscip-go gomod github.com/golang/go/src go1.18 `net/http`/Header#Get().("Location")) |
| 195 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, 301, w.Codescip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Code.) |
| 196 |
|
| 197 |
w = PerformRequestscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/PerformRequest().(router, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodGetscip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodGet., "/path2", headerscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/header#{Keyscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/header#Key.: "X-Forwarded-Prefix", Valuescip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/header#Value.: "../../api"}) |
| 198 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, "/api/path2/", w.Headerscip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Header().().Getscip-go gomod github.com/golang/go/src go1.18 `net/http`/Header#Get().("Location")) |
| 199 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, 301, w.Codescip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Code.) |
| 200 |
|
| 201 |
w = PerformRequestscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/PerformRequest().(router, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodGetscip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodGet., "/path2", headerscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/header#{Keyscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/header#Key.: "X-Forwarded-Prefix", Valuescip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/header#Value.: "/../../api"}) |
| 202 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, "/api/path2/", w.Headerscip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Header().().Getscip-go gomod github.com/golang/go/src go1.18 `net/http`/Header#Get().("Location")) |
| 203 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, 301, w.Codescip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Code.) |
| 204 |
|
| 205 |
w = PerformRequestscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/PerformRequest().(router, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodGetscip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodGet., "/path/", headerscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/header#{Keyscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/header#Key.: "X-Forwarded-Prefix", Valuescip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/header#Value.: "api/../../"}) |
| 206 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, "//path", w.Headerscip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Header().().Getscip-go gomod github.com/golang/go/src go1.18 `net/http`/Header#Get().("Location")) |
| 207 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, 301, w.Codescip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Code.) |
| 208 |
|
| 209 |
w = PerformRequestscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/PerformRequest().(router, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodGetscip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodGet., "/path/", headerscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/header#{Keyscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/header#Key.: "X-Forwarded-Prefix", Valuescip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/header#Value.: "api/../../../"}) |
| 210 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, "/path", w.Headerscip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Header().().Getscip-go gomod github.com/golang/go/src go1.18 `net/http`/Header#Get().("Location")) |
| 211 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, 301, w.Codescip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Code.) |
| 212 |
|
| 213 |
w = PerformRequestscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/PerformRequest().(router, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodGetscip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodGet., "/path2", headerscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/header#{Keyscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/header#Key.: "X-Forwarded-Prefix", Valuescip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/header#Value.: "../../gin-gonic.com"}) |
| 214 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, "/gin-goniccom/path2/", w.Headerscip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Header().().Getscip-go gomod github.com/golang/go/src go1.18 `net/http`/Header#Get().("Location")) |
| 215 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, 301, w.Codescip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Code.) |
| 216 |
|
| 217 |
w = PerformRequestscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/PerformRequest().(router, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodGetscip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodGet., "/path2", headerscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/header#{Keyscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/header#Key.: "X-Forwarded-Prefix", Valuescip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/header#Value.: "/../../gin-gonic.com"}) |
| 218 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, "/gin-goniccom/path2/", w.Headerscip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Header().().Getscip-go gomod github.com/golang/go/src go1.18 `net/http`/Header#Get().("Location")) |
| 219 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, 301, w.Codescip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Code.) |
| 220 |
|
| 221 |
w = PerformRequestscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/PerformRequest().(router, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodGetscip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodGet., "/path/", headerscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/header#{Keyscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/header#Key.: "X-Forwarded-Prefix", Valuescip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/header#Value.: "https://gin-gonic.com/#"}) |
| 222 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, "https/gin-goniccom/https/gin-goniccom/path", w.Headerscip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Header().().Getscip-go gomod github.com/golang/go/src go1.18 `net/http`/Header#Get().("Location")) |
| 223 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, 301, w.Codescip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Code.) |
| 224 |
|
| 225 |
w = PerformRequestscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/PerformRequest().(router, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodGetscip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodGet., "/path/", headerscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/header#{Keyscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/header#Key.: "X-Forwarded-Prefix", Valuescip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/header#Value.: "#api"}) |
| 226 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, "api/api/path", w.Headerscip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Header().().Getscip-go gomod github.com/golang/go/src go1.18 `net/http`/Header#Get().("Location")) |
| 227 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, 301, w.Codescip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Code.) |
| 228 |
|
| 229 |
w = PerformRequestscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/PerformRequest().(router, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodGetscip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodGet., "/path/", headerscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/header#{Keyscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/header#Key.: "X-Forwarded-Prefix", Valuescip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/header#Value.: "/nor-mal/#?a=1"}) |
| 230 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, "/nor-mal/a1/path", w.Headerscip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Header().().Getscip-go gomod github.com/golang/go/src go1.18 `net/http`/Header#Get().("Location")) |
| 231 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, 301, w.Codescip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Code.) |
| 232 |
|
| 233 |
w = PerformRequestscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/PerformRequest().(router, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodGetscip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodGet., "/path/", headerscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/header#{Keyscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/header#Key.: "X-Forwarded-Prefix", Valuescip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/header#Value.: "/nor-mal/%2e%2e/"}) |
| 234 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, "/nor-mal/2e2e/path", w.Headerscip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Header().().Getscip-go gomod github.com/golang/go/src go1.18 `net/http`/Header#Get().("Location")) |
| 235 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, 301, w.Codescip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Code.) |
| 236 |
|
| 237 |
router.RedirectTrailingSlashscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Engine#RedirectTrailingSlash. = false |
| 238 |
|
| 239 |
w = PerformRequestscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/PerformRequest().(router, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodGetscip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodGet., "/path/") |
| 240 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.StatusNotFoundscip-go gomod github.com/golang/go/src go1.18 `net/http`/StatusNotFound., w.Codescip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Code.) |
| 241 |
w = PerformRequestscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/PerformRequest().(router, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodGetscip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodGet., "/path2") |
| 242 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.StatusNotFoundscip-go gomod github.com/golang/go/src go1.18 `net/http`/StatusNotFound., w.Codescip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Code.) |
| 243 |
w = PerformRequestscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/PerformRequest().(router, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodPostscip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodPost., "/path3/") |
| 244 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.StatusNotFoundscip-go gomod github.com/golang/go/src go1.18 `net/http`/StatusNotFound., w.Codescip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Code.) |
| 245 |
w = PerformRequestscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/PerformRequest().(router, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodPutscip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodPut., "/path4") |
| 246 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.StatusNotFoundscip-go gomod github.com/golang/go/src go1.18 `net/http`/StatusNotFound., w.Codescip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Code.) |
| 247 |
} |
| 248 |
|
| 249 |
func TestRouteRedirectFixedPathscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/TestRouteRedirectFixedPath().(t *testingscip-go gomod github.com/golang/go/src go1.18 testing/.Tscip-go gomod github.com/golang/go/src go1.18 testing/T#) { |
| 250 |
router := Newscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/New().() |
| 251 |
router.RedirectFixedPathscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Engine#RedirectFixedPath. = true |
| 252 |
router.RedirectTrailingSlashscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Engine#RedirectTrailingSlash. = false |
| 253 |
|
| 254 |
router.GETscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/RouterGroup#GET().("/path", func(c *Contextscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Context#) {}) |
| 255 |
router.GETscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/RouterGroup#GET().("/Path2", func(c *Contextscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Context#) {}) |
| 256 |
router.POSTscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/RouterGroup#POST().("/PATH3", func(c *Contextscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Context#) {}) |
| 257 |
router.POSTscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/RouterGroup#POST().("/Path4/", func(c *Contextscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Context#) {}) |
| 258 |
|
| 259 |
w := PerformRequestscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/PerformRequest().(router, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodGetscip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodGet., "/PATH") |
| 260 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, "/path", w.Headerscip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Header().().Getscip-go gomod github.com/golang/go/src go1.18 `net/http`/Header#Get().("Location")) |
| 261 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.StatusMovedPermanentlyscip-go gomod github.com/golang/go/src go1.18 `net/http`/StatusMovedPermanently., w.Codescip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Code.) |
| 262 |
|
| 263 |
w = PerformRequestscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/PerformRequest().(router, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodGetscip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodGet., "/path2") |
| 264 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, "/Path2", w.Headerscip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Header().().Getscip-go gomod github.com/golang/go/src go1.18 `net/http`/Header#Get().("Location")) |
| 265 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.StatusMovedPermanentlyscip-go gomod github.com/golang/go/src go1.18 `net/http`/StatusMovedPermanently., w.Codescip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Code.) |
| 266 |
|
| 267 |
w = PerformRequestscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/PerformRequest().(router, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodPostscip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodPost., "/path3") |
| 268 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, "/PATH3", w.Headerscip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Header().().Getscip-go gomod github.com/golang/go/src go1.18 `net/http`/Header#Get().("Location")) |
| 269 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.StatusTemporaryRedirectscip-go gomod github.com/golang/go/src go1.18 `net/http`/StatusTemporaryRedirect., w.Codescip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Code.) |
| 270 |
|
| 271 |
w = PerformRequestscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/PerformRequest().(router, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodPostscip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodPost., "/path4") |
| 272 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, "/Path4/", w.Headerscip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Header().().Getscip-go gomod github.com/golang/go/src go1.18 `net/http`/Header#Get().("Location")) |
| 273 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.StatusTemporaryRedirectscip-go gomod github.com/golang/go/src go1.18 `net/http`/StatusTemporaryRedirect., w.Codescip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Code.) |
| 274 |
} |
| 275 |
|
| 276 |
// TestContextParamsGet tests that a parameter can be parsed from the URL. |
| 277 |
func TestRouteParamsByNamescip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/TestRouteParamsByName().(t *testingscip-go gomod github.com/golang/go/src go1.18 testing/.Tscip-go gomod github.com/golang/go/src go1.18 testing/T#) { |
| 278 |
name := "" |
| 279 |
lastName := "" |
| 280 |
wild := "" |
| 281 |
router := Newscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/New().() |
| 282 |
router.GETscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/RouterGroup#GET().("/test/:name/:last_name/*wild", func(c *Contextscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Context#) { |
| 283 |
name = c.Paramsscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Context#Params..ByNamescip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Params#ByName().("name") |
| 284 |
lastName = c.Paramsscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Context#Params..ByNamescip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Params#ByName().("last_name") |
| 285 |
var ok bool |
| 286 |
wild, ok = c.Paramsscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Context#Params..Getscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Params#Get().("wild") |
| 287 |
|
| 288 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Truescip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/True().(t, ok) |
| 289 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, name, c.Paramscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Context#Param().("name")) |
| 290 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, lastName, c.Paramscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Context#Param().("last_name")) |
| 291 |
|
| 292 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Emptyscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Empty().(t, c.Paramscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Context#Param().("wtf")) |
| 293 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Emptyscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Empty().(t, c.Paramsscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Context#Params..ByNamescip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Params#ByName().("wtf")) |
| 294 |
|
| 295 |
wtf, ok := c.Paramsscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Context#Params..Getscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Params#Get().("wtf") |
| 296 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Emptyscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Empty().(t, wtf) |
| 297 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Falsescip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/False().(t, ok) |
| 298 |
}) |
| 299 |
|
| 300 |
w := PerformRequestscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/PerformRequest().(router, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodGetscip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodGet., "/test/john/smith/is/super/great") |
| 301 |
|
| 302 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.StatusOKscip-go gomod github.com/golang/go/src go1.18 `net/http`/StatusOK., w.Codescip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Code.) |
| 303 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, "john", name) |
| 304 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, "smith", lastName) |
| 305 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, "/is/super/great", wild) |
| 306 |
} |
| 307 |
|
| 308 |
// TestContextParamsGet tests that a parameter can be parsed from the URL even with extra slashes. |
| 309 |
func TestRouteParamsByNameWithExtraSlashscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/TestRouteParamsByNameWithExtraSlash().(t *testingscip-go gomod github.com/golang/go/src go1.18 testing/.Tscip-go gomod github.com/golang/go/src go1.18 testing/T#) { |
| 310 |
name := "" |
| 311 |
lastName := "" |
| 312 |
wild := "" |
| 313 |
router := Newscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/New().() |
| 314 |
router.RemoveExtraSlashscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Engine#RemoveExtraSlash. = true |
| 315 |
router.GETscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/RouterGroup#GET().("/test/:name/:last_name/*wild", func(c *Contextscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Context#) { |
| 316 |
name = c.Paramsscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Context#Params..ByNamescip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Params#ByName().("name") |
| 317 |
lastName = c.Paramsscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Context#Params..ByNamescip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Params#ByName().("last_name") |
| 318 |
var ok bool |
| 319 |
wild, ok = c.Paramsscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Context#Params..Getscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Params#Get().("wild") |
| 320 |
|
| 321 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Truescip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/True().(t, ok) |
| 322 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, name, c.Paramscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Context#Param().("name")) |
| 323 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, lastName, c.Paramscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Context#Param().("last_name")) |
| 324 |
|
| 325 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Emptyscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Empty().(t, c.Paramscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Context#Param().("wtf")) |
| 326 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Emptyscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Empty().(t, c.Paramsscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Context#Params..ByNamescip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Params#ByName().("wtf")) |
| 327 |
|
| 328 |
wtf, ok := c.Paramsscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Context#Params..Getscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Params#Get().("wtf") |
| 329 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Emptyscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Empty().(t, wtf) |
| 330 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Falsescip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/False().(t, ok) |
| 331 |
}) |
| 332 |
|
| 333 |
w := PerformRequestscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/PerformRequest().(router, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodGetscip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodGet., "//test//john//smith//is//super//great") |
| 334 |
|
| 335 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.StatusOKscip-go gomod github.com/golang/go/src go1.18 `net/http`/StatusOK., w.Codescip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Code.) |
| 336 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, "john", name) |
| 337 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, "smith", lastName) |
| 338 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, "/is/super/great", wild) |
| 339 |
} |
| 340 |
|
| 341 |
// TestHandleStaticFile - ensure the static file handles properly |
| 342 |
func TestRouteStaticFilescip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/TestRouteStaticFile().(t *testingscip-go gomod github.com/golang/go/src go1.18 testing/.Tscip-go gomod github.com/golang/go/src go1.18 testing/T#) { |
| 343 |
// SETUP file |
| 344 |
testRoot, _ := osscip-go gomod github.com/golang/go/src go1.18 os/.Getwdscip-go gomod github.com/golang/go/src go1.18 os/Getwd().() |
| 345 |
f, err := ioutilscip-go gomod github.com/golang/go/src go1.18 `io/ioutil`/.TempFilescip-go gomod github.com/golang/go/src go1.18 `io/ioutil`/TempFile().(testRoot, "") |
| 346 |
if err != nil { |
| 347 |
t.Errorscip-go gomod github.com/golang/go/src go1.18 testing/common#Error().(err) |
| 348 |
} |
| 349 |
defer osscip-go gomod github.com/golang/go/src go1.18 os/.Removescip-go gomod github.com/golang/go/src go1.18 os/Remove().(f.Namescip-go gomod github.com/golang/go/src go1.18 os/File#Name().()) |
| 350 |
_, err = f.WriteStringscip-go gomod github.com/golang/go/src go1.18 os/File#WriteString().("Gin Web Framework") |
| 351 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/NoError().(t, err) |
| 352 |
f.Closescip-go gomod github.com/golang/go/src go1.18 os/File#Close().() |
| 353 |
|
| 354 |
dir, filename := filepathscip-go gomod github.com/golang/go/src go1.18 `path/filepath`/.Splitscip-go gomod github.com/golang/go/src go1.18 `path/filepath`/Split().(f.Namescip-go gomod github.com/golang/go/src go1.18 os/File#Name().()) |
| 355 |
|
| 356 |
// SETUP gin |
| 357 |
router := Newscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/New().() |
| 358 |
router.Staticscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/RouterGroup#Static().("/using_static", dir) |
| 359 |
router.StaticFilescip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/RouterGroup#StaticFile().("/result", f.Namescip-go gomod github.com/golang/go/src go1.18 os/File#Name().()) |
| 360 |
|
| 361 |
w := PerformRequestscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/PerformRequest().(router, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodGetscip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodGet., "/using_static/"+filename) |
| 362 |
w2 := PerformRequestscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/PerformRequest().(router, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodGetscip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodGet., "/result") |
| 363 |
|
| 364 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, w, w2) |
| 365 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.StatusOKscip-go gomod github.com/golang/go/src go1.18 `net/http`/StatusOK., w.Codescip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Code.) |
| 366 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, "Gin Web Framework", w.Bodyscip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Body..Stringscip-go gomod github.com/golang/go/src go1.18 bytes/Buffer#String().()) |
| 367 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, "text/plain; charset=utf-8", w.Headerscip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Header().().Getscip-go gomod github.com/golang/go/src go1.18 `net/http`/Header#Get().("Content-Type")) |
| 368 |
|
| 369 |
w3 := PerformRequestscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/PerformRequest().(router, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodHeadscip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodHead., "/using_static/"+filename) |
| 370 |
w4 := PerformRequestscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/PerformRequest().(router, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodHeadscip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodHead., "/result") |
| 371 |
|
| 372 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, w3, w4) |
| 373 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.StatusOKscip-go gomod github.com/golang/go/src go1.18 `net/http`/StatusOK., w3.Codescip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Code.) |
| 374 |
} |
| 375 |
|
| 376 |
// TestHandleStaticFile - ensure the static file handles properly |
| 377 |
func TestRouteStaticFileFSscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/TestRouteStaticFileFS().(t *testingscip-go gomod github.com/golang/go/src go1.18 testing/.Tscip-go gomod github.com/golang/go/src go1.18 testing/T#) { |
| 378 |
// SETUP file |
| 379 |
testRoot, _ := osscip-go gomod github.com/golang/go/src go1.18 os/.Getwdscip-go gomod github.com/golang/go/src go1.18 os/Getwd().() |
| 380 |
f, err := ioutilscip-go gomod github.com/golang/go/src go1.18 `io/ioutil`/.TempFilescip-go gomod github.com/golang/go/src go1.18 `io/ioutil`/TempFile().(testRoot, "") |
| 381 |
if err != nil { |
| 382 |
t.Errorscip-go gomod github.com/golang/go/src go1.18 testing/common#Error().(err) |
| 383 |
} |
| 384 |
defer osscip-go gomod github.com/golang/go/src go1.18 os/.Removescip-go gomod github.com/golang/go/src go1.18 os/Remove().(f.Namescip-go gomod github.com/golang/go/src go1.18 os/File#Name().()) |
| 385 |
_, err = f.WriteStringscip-go gomod github.com/golang/go/src go1.18 os/File#WriteString().("Gin Web Framework") |
| 386 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/NoError().(t, err) |
| 387 |
f.Closescip-go gomod github.com/golang/go/src go1.18 os/File#Close().() |
| 388 |
|
| 389 |
dir, filename := filepathscip-go gomod github.com/golang/go/src go1.18 `path/filepath`/.Splitscip-go gomod github.com/golang/go/src go1.18 `path/filepath`/Split().(f.Namescip-go gomod github.com/golang/go/src go1.18 os/File#Name().()) |
| 390 |
// SETUP gin |
| 391 |
router := Newscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/New().() |
| 392 |
router.Staticscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/RouterGroup#Static().("/using_static", dir) |
| 393 |
router.StaticFileFSscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/RouterGroup#StaticFileFS().("/result_fs", filename, Dirscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Dir().(dir, false)) |
| 394 |
|
| 395 |
w := PerformRequestscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/PerformRequest().(router, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodGetscip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodGet., "/using_static/"+filename) |
| 396 |
w2 := PerformRequestscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/PerformRequest().(router, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodGetscip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodGet., "/result_fs") |
| 397 |
|
| 398 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, w, w2) |
| 399 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.StatusOKscip-go gomod github.com/golang/go/src go1.18 `net/http`/StatusOK., w.Codescip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Code.) |
| 400 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, "Gin Web Framework", w.Bodyscip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Body..Stringscip-go gomod github.com/golang/go/src go1.18 bytes/Buffer#String().()) |
| 401 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, "text/plain; charset=utf-8", w.Headerscip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Header().().Getscip-go gomod github.com/golang/go/src go1.18 `net/http`/Header#Get().("Content-Type")) |
| 402 |
|
| 403 |
w3 := PerformRequestscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/PerformRequest().(router, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodHeadscip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodHead., "/using_static/"+filename) |
| 404 |
w4 := PerformRequestscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/PerformRequest().(router, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodHeadscip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodHead., "/result_fs") |
| 405 |
|
| 406 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, w3, w4) |
| 407 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.StatusOKscip-go gomod github.com/golang/go/src go1.18 `net/http`/StatusOK., w3.Codescip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Code.) |
| 408 |
} |
| 409 |
|
| 410 |
// TestHandleStaticDir - ensure the root/sub dir handles properly |
| 411 |
func TestRouteStaticListingDirscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/TestRouteStaticListingDir().(t *testingscip-go gomod github.com/golang/go/src go1.18 testing/.Tscip-go gomod github.com/golang/go/src go1.18 testing/T#) { |
| 412 |
router := Newscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/New().() |
| 413 |
router.StaticFSscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/RouterGroup#StaticFS().("/", Dirscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Dir().("./", true)) |
| 414 |
|
| 415 |
w := PerformRequestscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/PerformRequest().(router, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodGetscip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodGet., "/") |
| 416 |
|
| 417 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.StatusOKscip-go gomod github.com/golang/go/src go1.18 `net/http`/StatusOK., w.Codescip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Code.) |
| 418 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Containsscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Contains().(t, w.Bodyscip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Body..Stringscip-go gomod github.com/golang/go/src go1.18 bytes/Buffer#String().(), "gin.go") |
| 419 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, "text/html; charset=utf-8", w.Headerscip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Header().().Getscip-go gomod github.com/golang/go/src go1.18 `net/http`/Header#Get().("Content-Type")) |
| 420 |
} |
| 421 |
|
| 422 |
// TestHandleHeadToDir - ensure the root/sub dir handles properly |
| 423 |
func TestRouteStaticNoListingscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/TestRouteStaticNoListing().(t *testingscip-go gomod github.com/golang/go/src go1.18 testing/.Tscip-go gomod github.com/golang/go/src go1.18 testing/T#) { |
| 424 |
router := Newscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/New().() |
| 425 |
router.Staticscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/RouterGroup#Static().("/", "./") |
| 426 |
|
| 427 |
w := PerformRequestscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/PerformRequest().(router, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodGetscip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodGet., "/") |
| 428 |
|
| 429 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.StatusNotFoundscip-go gomod github.com/golang/go/src go1.18 `net/http`/StatusNotFound., w.Codescip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Code.) |
| 430 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.NotContainsscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/NotContains().(t, w.Bodyscip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Body..Stringscip-go gomod github.com/golang/go/src go1.18 bytes/Buffer#String().(), "gin.go") |
| 431 |
} |
| 432 |
|
| 433 |
func TestRouterMiddlewareAndStaticscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/TestRouterMiddlewareAndStatic().(t *testingscip-go gomod github.com/golang/go/src go1.18 testing/.Tscip-go gomod github.com/golang/go/src go1.18 testing/T#) { |
| 434 |
router := Newscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/New().() |
| 435 |
static := router.Groupscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/RouterGroup#Group().("/", func(c *Contextscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Context#) { |
| 436 |
c.Writerscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Context#Writer..Headerscip-go gomod github.com/golang/go/src go1.18 `net/http`/ResponseWriter#Header().().Addscip-go gomod github.com/golang/go/src go1.18 `net/http`/Header#Add().("Last-Modified", "Mon, 02 Jan 2006 15:04:05 MST") |
| 437 |
c.Writerscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Context#Writer..Headerscip-go gomod github.com/golang/go/src go1.18 `net/http`/ResponseWriter#Header().().Addscip-go gomod github.com/golang/go/src go1.18 `net/http`/Header#Add().("Expires", "Mon, 02 Jan 2006 15:04:05 MST") |
| 438 |
c.Writerscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Context#Writer..Headerscip-go gomod github.com/golang/go/src go1.18 `net/http`/ResponseWriter#Header().().Addscip-go gomod github.com/golang/go/src go1.18 `net/http`/Header#Add().("X-GIN", "Gin Framework") |
| 439 |
}) |
| 440 |
static.Staticscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/RouterGroup#Static().("/", "./") |
| 441 |
|
| 442 |
w := PerformRequestscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/PerformRequest().(router, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodGetscip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodGet., "/gin.go") |
| 443 |
|
| 444 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.StatusOKscip-go gomod github.com/golang/go/src go1.18 `net/http`/StatusOK., w.Codescip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Code.) |
| 445 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Containsscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Contains().(t, w.Bodyscip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Body..Stringscip-go gomod github.com/golang/go/src go1.18 bytes/Buffer#String().(), "package gin") |
| 446 |
// Content-Type='text/plain; charset=utf-8' when go version <= 1.16, |
| 447 |
// else, Content-Type='text/x-go; charset=utf-8' |
| 448 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.NotEqualscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/NotEqual().(t, "", w.Headerscip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Header().().Getscip-go gomod github.com/golang/go/src go1.18 `net/http`/Header#Get().("Content-Type")) |
| 449 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.NotEqualscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/NotEqual().(t, w.Headerscip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Header().().Getscip-go gomod github.com/golang/go/src go1.18 `net/http`/Header#Get().("Last-Modified"), "Mon, 02 Jan 2006 15:04:05 MST") |
| 450 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, "Mon, 02 Jan 2006 15:04:05 MST", w.Headerscip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Header().().Getscip-go gomod github.com/golang/go/src go1.18 `net/http`/Header#Get().("Expires")) |
| 451 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, "Gin Framework", w.Headerscip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Header().().Getscip-go gomod github.com/golang/go/src go1.18 `net/http`/Header#Get().("x-GIN")) |
| 452 |
} |
| 453 |
|
| 454 |
func TestRouteNotAllowedEnabledscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/TestRouteNotAllowedEnabled().(t *testingscip-go gomod github.com/golang/go/src go1.18 testing/.Tscip-go gomod github.com/golang/go/src go1.18 testing/T#) { |
| 455 |
router := Newscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/New().() |
| 456 |
router.HandleMethodNotAllowedscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Engine#HandleMethodNotAllowed. = true |
| 457 |
router.POSTscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/RouterGroup#POST().("/path", func(c *Contextscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Context#) {}) |
| 458 |
w := PerformRequestscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/PerformRequest().(router, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodGetscip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodGet., "/path") |
| 459 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.StatusMethodNotAllowedscip-go gomod github.com/golang/go/src go1.18 `net/http`/StatusMethodNotAllowed., w.Codescip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Code.) |
| 460 |
|
| 461 |
router.NoMethodscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Engine#NoMethod().(func(c *Contextscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Context#) { |
| 462 |
c.Stringscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Context#String().(httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.StatusTeapotscip-go gomod github.com/golang/go/src go1.18 `net/http`/StatusTeapot., "responseText") |
| 463 |
}) |
| 464 |
w = PerformRequestscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/PerformRequest().(router, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodGetscip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodGet., "/path") |
| 465 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, "responseText", w.Bodyscip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Body..Stringscip-go gomod github.com/golang/go/src go1.18 bytes/Buffer#String().()) |
| 466 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.StatusTeapotscip-go gomod github.com/golang/go/src go1.18 `net/http`/StatusTeapot., w.Codescip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Code.) |
| 467 |
} |
| 468 |
|
| 469 |
func TestRouteNotAllowedEnabled2scip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/TestRouteNotAllowedEnabled2().(t *testingscip-go gomod github.com/golang/go/src go1.18 testing/.Tscip-go gomod github.com/golang/go/src go1.18 testing/T#) { |
| 470 |
router := Newscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/New().() |
| 471 |
router.HandleMethodNotAllowedscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Engine#HandleMethodNotAllowed. = true |
| 472 |
// add one methodTree to trees |
| 473 |
router.addRoutescip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Engine#addRoute().(httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodPostscip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodPost., "/", HandlersChainscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/HandlersChain#{func(_ *Contextscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Context#) {}}) |
| 474 |
router.GETscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/RouterGroup#GET().("/path2", func(c *Contextscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Context#) {}) |
| 475 |
w := PerformRequestscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/PerformRequest().(router, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodPostscip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodPost., "/path2") |
| 476 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.StatusMethodNotAllowedscip-go gomod github.com/golang/go/src go1.18 `net/http`/StatusMethodNotAllowed., w.Codescip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Code.) |
| 477 |
} |
| 478 |
|
| 479 |
func TestRouteNotAllowedDisabledscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/TestRouteNotAllowedDisabled().(t *testingscip-go gomod github.com/golang/go/src go1.18 testing/.Tscip-go gomod github.com/golang/go/src go1.18 testing/T#) { |
| 480 |
router := Newscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/New().() |
| 481 |
router.HandleMethodNotAllowedscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Engine#HandleMethodNotAllowed. = false |
| 482 |
router.POSTscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/RouterGroup#POST().("/path", func(c *Contextscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Context#) {}) |
| 483 |
w := PerformRequestscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/PerformRequest().(router, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodGetscip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodGet., "/path") |
| 484 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.StatusNotFoundscip-go gomod github.com/golang/go/src go1.18 `net/http`/StatusNotFound., w.Codescip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Code.) |
| 485 |
|
| 486 |
router.NoMethodscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Engine#NoMethod().(func(c *Contextscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Context#) { |
| 487 |
c.Stringscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Context#String().(httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.StatusTeapotscip-go gomod github.com/golang/go/src go1.18 `net/http`/StatusTeapot., "responseText") |
| 488 |
}) |
| 489 |
w = PerformRequestscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/PerformRequest().(router, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodGetscip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodGet., "/path") |
| 490 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, "404 page not found", w.Bodyscip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Body..Stringscip-go gomod github.com/golang/go/src go1.18 bytes/Buffer#String().()) |
| 491 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.StatusNotFoundscip-go gomod github.com/golang/go/src go1.18 `net/http`/StatusNotFound., w.Codescip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Code.) |
| 492 |
} |
| 493 |
|
| 494 |
func TestRouterNotFoundWithRemoveExtraSlashscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/TestRouterNotFoundWithRemoveExtraSlash().(t *testingscip-go gomod github.com/golang/go/src go1.18 testing/.Tscip-go gomod github.com/golang/go/src go1.18 testing/T#) { |
| 495 |
router := Newscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/New().() |
| 496 |
router.RemoveExtraSlashscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Engine#RemoveExtraSlash. = true |
| 497 |
router.GETscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/RouterGroup#GET().("/path", func(c *Contextscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Context#) {}) |
| 498 |
router.GETscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/RouterGroup#GET().("/", func(c *Contextscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Context#) {}) |
| 499 |
|
| 500 |
testRoutes := []struct { |
| 501 |
route string |
| 502 |
code int |
| 503 |
location string |
| 504 |
}{ |
| 505 |
{"/../path", httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.StatusOKscip-go gomod github.com/golang/go/src go1.18 `net/http`/StatusOK., ""}, // CleanPath |
| 506 |
{"/nope", httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.StatusNotFoundscip-go gomod github.com/golang/go/src go1.18 `net/http`/StatusNotFound., ""}, // NotFound |
| 507 |
} |
| 508 |
for _, tr := range testRoutes { |
| 509 |
w := PerformRequestscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/PerformRequest().(router, "GET", tr.route) |
| 510 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, tr.code, w.Codescip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Code.) |
| 511 |
if w.Codescip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Code. != httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.StatusNotFoundscip-go gomod github.com/golang/go/src go1.18 `net/http`/StatusNotFound. { |
| 512 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, tr.location, fmtscip-go gomod github.com/golang/go/src go1.18 fmt/.Sprintscip-go gomod github.com/golang/go/src go1.18 fmt/Sprint().(w.Headerscip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Header().().Getscip-go gomod github.com/golang/go/src go1.18 `net/http`/Header#Get().("Location"))) |
| 513 |
} |
| 514 |
} |
| 515 |
} |
| 516 |
|
| 517 |
func TestRouterNotFoundscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/TestRouterNotFound().(t *testingscip-go gomod github.com/golang/go/src go1.18 testing/.Tscip-go gomod github.com/golang/go/src go1.18 testing/T#) { |
| 518 |
router := Newscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/New().() |
| 519 |
router.RedirectFixedPathscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Engine#RedirectFixedPath. = true |
| 520 |
router.GETscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/RouterGroup#GET().("/path", func(c *Contextscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Context#) {}) |
| 521 |
router.GETscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/RouterGroup#GET().("/dir/", func(c *Contextscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Context#) {}) |
| 522 |
router.GETscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/RouterGroup#GET().("/", func(c *Contextscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Context#) {}) |
| 523 |
|
| 524 |
testRoutes := []struct { |
| 525 |
route string |
| 526 |
code int |
| 527 |
location string |
| 528 |
}{ |
| 529 |
{"/path/", httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.StatusMovedPermanentlyscip-go gomod github.com/golang/go/src go1.18 `net/http`/StatusMovedPermanently., "/path"}, // TSR -/ |
| 530 |
{"/dir", httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.StatusMovedPermanentlyscip-go gomod github.com/golang/go/src go1.18 `net/http`/StatusMovedPermanently., "/dir/"}, // TSR +/ |
| 531 |
{"/PATH", httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.StatusMovedPermanentlyscip-go gomod github.com/golang/go/src go1.18 `net/http`/StatusMovedPermanently., "/path"}, // Fixed Case |
| 532 |
{"/DIR/", httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.StatusMovedPermanentlyscip-go gomod github.com/golang/go/src go1.18 `net/http`/StatusMovedPermanently., "/dir/"}, // Fixed Case |
| 533 |
{"/PATH/", httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.StatusMovedPermanentlyscip-go gomod github.com/golang/go/src go1.18 `net/http`/StatusMovedPermanently., "/path"}, // Fixed Case -/ |
| 534 |
{"/DIR", httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.StatusMovedPermanentlyscip-go gomod github.com/golang/go/src go1.18 `net/http`/StatusMovedPermanently., "/dir/"}, // Fixed Case +/ |
| 535 |
{"/../path", httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.StatusMovedPermanentlyscip-go gomod github.com/golang/go/src go1.18 `net/http`/StatusMovedPermanently., "/path"}, // Without CleanPath |
| 536 |
{"/nope", httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.StatusNotFoundscip-go gomod github.com/golang/go/src go1.18 `net/http`/StatusNotFound., ""}, // NotFound |
| 537 |
} |
| 538 |
for _, tr := range testRoutes { |
| 539 |
w := PerformRequestscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/PerformRequest().(router, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodGetscip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodGet., tr.route) |
| 540 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, tr.code, w.Codescip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Code.) |
| 541 |
if w.Codescip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Code. != httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.StatusNotFoundscip-go gomod github.com/golang/go/src go1.18 `net/http`/StatusNotFound. { |
| 542 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, tr.location, fmtscip-go gomod github.com/golang/go/src go1.18 fmt/.Sprintscip-go gomod github.com/golang/go/src go1.18 fmt/Sprint().(w.Headerscip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Header().().Getscip-go gomod github.com/golang/go/src go1.18 `net/http`/Header#Get().("Location"))) |
| 543 |
} |
| 544 |
} |
| 545 |
|
| 546 |
// Test custom not found handler |
| 547 |
var notFound bool |
| 548 |
router.NoRoutescip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Engine#NoRoute().(func(c *Contextscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Context#) { |
| 549 |
c.AbortWithStatusscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Context#AbortWithStatus().(httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.StatusNotFoundscip-go gomod github.com/golang/go/src go1.18 `net/http`/StatusNotFound.) |
| 550 |
notFound = true |
| 551 |
}) |
| 552 |
w := PerformRequestscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/PerformRequest().(router, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodGetscip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodGet., "/nope") |
| 553 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.StatusNotFoundscip-go gomod github.com/golang/go/src go1.18 `net/http`/StatusNotFound., w.Codescip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Code.) |
| 554 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Truescip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/True().(t, notFound) |
| 555 |
|
| 556 |
// Test other method than GET (want 307 instead of 301) |
| 557 |
router.PATCHscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/RouterGroup#PATCH().("/path", func(c *Contextscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Context#) {}) |
| 558 |
w = PerformRequestscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/PerformRequest().(router, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodPatchscip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodPatch., "/path/") |
| 559 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.StatusTemporaryRedirectscip-go gomod github.com/golang/go/src go1.18 `net/http`/StatusTemporaryRedirect., w.Codescip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Code.) |
| 560 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, "map[Location:[/path]]", fmtscip-go gomod github.com/golang/go/src go1.18 fmt/.Sprintscip-go gomod github.com/golang/go/src go1.18 fmt/Sprint().(w.Headerscip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Header().())) |
| 561 |
|
| 562 |
// Test special case where no node for the prefix "/" exists |
| 563 |
router = Newscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/New().() |
| 564 |
router.GETscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/RouterGroup#GET().("/a", func(c *Contextscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Context#) {}) |
| 565 |
w = PerformRequestscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/PerformRequest().(router, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodGetscip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodGet., "/") |
| 566 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.StatusNotFoundscip-go gomod github.com/golang/go/src go1.18 `net/http`/StatusNotFound., w.Codescip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Code.) |
| 567 |
|
| 568 |
// Reproduction test for the bug of issue #2843 |
| 569 |
router = Newscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/New().() |
| 570 |
router.NoRoutescip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Engine#NoRoute().(func(c *Contextscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Context#) { |
| 571 |
if c.Requestscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Context#Request..RequestURIscip-go gomod github.com/golang/go/src go1.18 `net/http`/Request#RequestURI. == "/login" { |
| 572 |
c.Stringscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Context#String().(200, "login") |
| 573 |
} |
| 574 |
}) |
| 575 |
router.GETscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/RouterGroup#GET().("/logout", func(c *Contextscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Context#) { |
| 576 |
c.Stringscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Context#String().(200, "logout") |
| 577 |
}) |
| 578 |
w = PerformRequestscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/PerformRequest().(router, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodGetscip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodGet., "/login") |
| 579 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, "login", w.Bodyscip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Body..Stringscip-go gomod github.com/golang/go/src go1.18 bytes/Buffer#String().()) |
| 580 |
w = PerformRequestscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/PerformRequest().(router, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodGetscip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodGet., "/logout") |
| 581 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, "logout", w.Bodyscip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Body..Stringscip-go gomod github.com/golang/go/src go1.18 bytes/Buffer#String().()) |
| 582 |
} |
| 583 |
|
| 584 |
func TestRouterStaticFSNotFoundscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/TestRouterStaticFSNotFound().(t *testingscip-go gomod github.com/golang/go/src go1.18 testing/.Tscip-go gomod github.com/golang/go/src go1.18 testing/T#) { |
| 585 |
router := Newscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/New().() |
| 586 |
router.StaticFSscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/RouterGroup#StaticFS().("/", httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.FileSystemscip-go gomod github.com/golang/go/src go1.18 `net/http`/FileSystem#(httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.Dirscip-go gomod github.com/golang/go/src go1.18 `net/http`/Dir#("/thisreallydoesntexist/"))) |
| 587 |
router.NoRoutescip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Engine#NoRoute().(func(c *Contextscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Context#) { |
| 588 |
c.Stringscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Context#String().(404, "non existent") |
| 589 |
}) |
| 590 |
|
| 591 |
w := PerformRequestscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/PerformRequest().(router, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodGetscip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodGet., "/nonexistent") |
| 592 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, "non existent", w.Bodyscip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Body..Stringscip-go gomod github.com/golang/go/src go1.18 bytes/Buffer#String().()) |
| 593 |
|
| 594 |
w = PerformRequestscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/PerformRequest().(router, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodHeadscip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodHead., "/nonexistent") |
| 595 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, "non existent", w.Bodyscip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Body..Stringscip-go gomod github.com/golang/go/src go1.18 bytes/Buffer#String().()) |
| 596 |
} |
| 597 |
|
| 598 |
func TestRouterStaticFSFileNotFoundscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/TestRouterStaticFSFileNotFound().(t *testingscip-go gomod github.com/golang/go/src go1.18 testing/.Tscip-go gomod github.com/golang/go/src go1.18 testing/T#) { |
| 599 |
router := Newscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/New().() |
| 600 |
|
| 601 |
router.StaticFSscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/RouterGroup#StaticFS().("/", httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.FileSystemscip-go gomod github.com/golang/go/src go1.18 `net/http`/FileSystem#(httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.Dirscip-go gomod github.com/golang/go/src go1.18 `net/http`/Dir#("."))) |
| 602 |
|
| 603 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.NotPanicsscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/NotPanics().(t, func() { |
| 604 |
PerformRequestscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/PerformRequest().(router, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodGetscip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodGet., "/nonexistent") |
| 605 |
}) |
| 606 |
} |
| 607 |
|
| 608 |
// Reproduction test for the bug of issue #1805 |
| 609 |
func TestMiddlewareCalledOnceByRouterStaticFSNotFoundscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/TestMiddlewareCalledOnceByRouterStaticFSNotFound().(t *testingscip-go gomod github.com/golang/go/src go1.18 testing/.Tscip-go gomod github.com/golang/go/src go1.18 testing/T#) { |
| 610 |
router := Newscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/New().() |
| 611 |
|
| 612 |
// Middleware must be called just only once by per request. |
| 613 |
middlewareCalledNum := 0 |
| 614 |
router.Usescip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Engine#Use().(func(c *Contextscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Context#) { |
| 615 |
middlewareCalledNum++ |
| 616 |
}) |
| 617 |
|
| 618 |
router.StaticFSscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/RouterGroup#StaticFS().("/", httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.FileSystemscip-go gomod github.com/golang/go/src go1.18 `net/http`/FileSystem#(httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.Dirscip-go gomod github.com/golang/go/src go1.18 `net/http`/Dir#("/thisreallydoesntexist/"))) |
| 619 |
|
| 620 |
// First access |
| 621 |
PerformRequestscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/PerformRequest().(router, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodGetscip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodGet., "/nonexistent") |
| 622 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, 1, middlewareCalledNum) |
| 623 |
|
| 624 |
// Second access |
| 625 |
PerformRequestscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/PerformRequest().(router, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodHeadscip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodHead., "/nonexistent") |
| 626 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, 2, middlewareCalledNum) |
| 627 |
} |
| 628 |
|
| 629 |
func TestRouteRawPathscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/TestRouteRawPath().(t *testingscip-go gomod github.com/golang/go/src go1.18 testing/.Tscip-go gomod github.com/golang/go/src go1.18 testing/T#) { |
| 630 |
route := Newscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/New().() |
| 631 |
route.UseRawPathscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Engine#UseRawPath. = true |
| 632 |
|
| 633 |
route.POSTscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/RouterGroup#POST().("/project/:name/build/:num", func(c *Contextscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Context#) { |
| 634 |
name := c.Paramsscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Context#Params..ByNamescip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Params#ByName().("name") |
| 635 |
num := c.Paramsscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Context#Params..ByNamescip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Params#ByName().("num") |
| 636 |
|
| 637 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, name, c.Paramscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Context#Param().("name")) |
| 638 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, num, c.Paramscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Context#Param().("num")) |
| 639 |
|
| 640 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, "Some/Other/Project", name) |
| 641 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, "222", num) |
| 642 |
}) |
| 643 |
|
| 644 |
w := PerformRequestscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/PerformRequest().(route, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodPostscip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodPost., "/project/Some%2FOther%2FProject/build/222") |
| 645 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.StatusOKscip-go gomod github.com/golang/go/src go1.18 `net/http`/StatusOK., w.Codescip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Code.) |
| 646 |
} |
| 647 |
|
| 648 |
func TestRouteRawPathNoUnescapescip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/TestRouteRawPathNoUnescape().(t *testingscip-go gomod github.com/golang/go/src go1.18 testing/.Tscip-go gomod github.com/golang/go/src go1.18 testing/T#) { |
| 649 |
route := Newscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/New().() |
| 650 |
route.UseRawPathscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Engine#UseRawPath. = true |
| 651 |
route.UnescapePathValuesscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Engine#UnescapePathValues. = false |
| 652 |
|
| 653 |
route.POSTscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/RouterGroup#POST().("/project/:name/build/:num", func(c *Contextscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Context#) { |
| 654 |
name := c.Paramsscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Context#Params..ByNamescip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Params#ByName().("name") |
| 655 |
num := c.Paramsscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Context#Params..ByNamescip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Params#ByName().("num") |
| 656 |
|
| 657 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, name, c.Paramscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Context#Param().("name")) |
| 658 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, num, c.Paramscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Context#Param().("num")) |
| 659 |
|
| 660 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, "Some%2FOther%2FProject", name) |
| 661 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, "333", num) |
| 662 |
}) |
| 663 |
|
| 664 |
w := PerformRequestscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/PerformRequest().(route, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodPostscip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodPost., "/project/Some%2FOther%2FProject/build/333") |
| 665 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.StatusOKscip-go gomod github.com/golang/go/src go1.18 `net/http`/StatusOK., w.Codescip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Code.) |
| 666 |
} |
| 667 |
|
| 668 |
func TestRouteServeErrorWithWriteHeaderscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/TestRouteServeErrorWithWriteHeader().(t *testingscip-go gomod github.com/golang/go/src go1.18 testing/.Tscip-go gomod github.com/golang/go/src go1.18 testing/T#) { |
| 669 |
route := Newscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/New().() |
| 670 |
route.Usescip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Engine#Use().(func(c *Contextscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Context#) { |
| 671 |
c.Statusscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Context#Status().(421) |
| 672 |
c.Nextscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Context#Next().() |
| 673 |
}) |
| 674 |
|
| 675 |
w := PerformRequestscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/PerformRequest().(route, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodGetscip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodGet., "/NotFound") |
| 676 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, 421, w.Codescip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Code.) |
| 677 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, 0, w.Bodyscip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Body..Lenscip-go gomod github.com/golang/go/src go1.18 bytes/Buffer#Len().()) |
| 678 |
} |
| 679 |
|
| 680 |
func TestRouteContextHoldsFullPathscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/TestRouteContextHoldsFullPath().(t *testingscip-go gomod github.com/golang/go/src go1.18 testing/.Tscip-go gomod github.com/golang/go/src go1.18 testing/T#) { |
| 681 |
router := Newscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/New().() |
| 682 |
|
| 683 |
// Test routes |
| 684 |
routes := []string{ |
| 685 |
"/simple", |
| 686 |
"/project/:name", |
| 687 |
"/", |
| 688 |
"/news/home", |
| 689 |
"/news", |
| 690 |
"/simple-two/one", |
| 691 |
"/simple-two/one-two", |
| 692 |
"/project/:name/build/*params", |
| 693 |
"/project/:name/bui", |
| 694 |
"/user/:id/status", |
| 695 |
"/user/:id", |
| 696 |
"/user/:id/profile", |
| 697 |
} |
| 698 |
|
| 699 |
for _, route := range routes { |
| 700 |
actualRoute := route |
| 701 |
router.GETscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/RouterGroup#GET().(route, func(c *Contextscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Context#) { |
| 702 |
// For each defined route context should contain its full path |
| 703 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, actualRoute, c.FullPathscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Context#FullPath().()) |
| 704 |
c.AbortWithStatusscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Context#AbortWithStatus().(httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.StatusOKscip-go gomod github.com/golang/go/src go1.18 `net/http`/StatusOK.) |
| 705 |
}) |
| 706 |
} |
| 707 |
|
| 708 |
for _, route := range routes { |
| 709 |
w := PerformRequestscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/PerformRequest().(router, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodGetscip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodGet., route) |
| 710 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.StatusOKscip-go gomod github.com/golang/go/src go1.18 `net/http`/StatusOK., w.Codescip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Code.) |
| 711 |
} |
| 712 |
|
| 713 |
// Test not found |
| 714 |
router.Usescip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Engine#Use().(func(c *Contextscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Context#) { |
| 715 |
// For not found routes full path is empty |
| 716 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, "", c.FullPathscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/Context#FullPath().()) |
| 717 |
}) |
| 718 |
|
| 719 |
w := PerformRequestscip-go gomod github.com/gin-gonic/gin . `github.com/gin-gonic/gin`/PerformRequest().(router, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.MethodGetscip-go gomod github.com/golang/go/src go1.18 `net/http`/MethodGet., "/not-found") |
| 720 |
assertscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.1 `github.com/stretchr/testify/assert`/Equal().(t, httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.StatusNotFoundscip-go gomod github.com/golang/go/src go1.18 `net/http`/StatusNotFound., w.Codescip-go gomod github.com/golang/go/src go1.18 `net/http/httptest`/ResponseRecorder#Code.) |
| 721 |
} |