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

Function TestEngineHandleContextUseEscapedPathPercentEncoded

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

Source from the content-addressed store, hash-verified

744}
745
746func TestEngineHandleContextUseEscapedPathPercentEncoded(t *testing.T) {
747 r := New()
748 r.UseEscapedPath = true
749 r.UnescapePathValues = false
750
751 r.GET("/v1/:path", func(c *Context) {
752 // Path is Escaped, the %25 is not interpreted as %
753 assert.Equal(t, "foo%252Fbar", c.Param("path"))
754 c.Status(http.StatusOK)
755 })
756
757 req := httptest.NewRequest(http.MethodGet, "/v1/foo%252Fbar", nil)
758 w := httptest.NewRecorder()
759 r.ServeHTTP(w, req)
760}
761
762func TestEngineHandleContextUseRawPathPercentEncoded(t *testing.T) {
763 r := New()

Callers

nothing calls this directly

Calls 5

NewFunction · 0.85
ParamMethod · 0.80
GETMethod · 0.65
StatusMethod · 0.65
ServeHTTPMethod · 0.45

Tested by

no test coverage detected