MCPcopy
hub / github.com/gin-gonic/gin / TestEngineHandleContextUseEscapedPathOverride

Function TestEngineHandleContextUseEscapedPathOverride

gin_test.go:778–793  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

776}
777
778func TestEngineHandleContextUseEscapedPathOverride(t *testing.T) {
779 r := New()
780 r.UseEscapedPath = true
781 r.UseRawPath = true
782 r.UnescapePathValues = false
783
784 r.GET("/v1/:path", func(c *Context) {
785 assert.Equal(t, "foo%25bar", c.Param("path"))
786 c.Status(http.StatusOK)
787 })
788
789 assert.NotPanics(t, func() {
790 w := PerformRequest(r, http.MethodGet, "/v1/foo%25bar")
791 assert.Equal(t, 200, w.Code)
792 })
793}
794
795func TestPrepareTrustedCIRDsWith(t *testing.T) {
796 r := New()

Callers

nothing calls this directly

Calls 5

NewFunction · 0.85
PerformRequestFunction · 0.85
ParamMethod · 0.80
GETMethod · 0.65
StatusMethod · 0.65

Tested by

no test coverage detected