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

Function TestEngineHandleContextUseRawPathPercentEncoded

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

Source from the content-addressed store, hash-verified

760}
761
762func TestEngineHandleContextUseRawPathPercentEncoded(t *testing.T) {
763 r := New()
764 r.UseRawPath = true
765 r.UnescapePathValues = false
766
767 r.GET("/v1/:path", func(c *Context) {
768 // Path is used, the %25 is interpreted as %
769 assert.Equal(t, "foo%2Fbar", c.Param("path"))
770 c.Status(http.StatusOK)
771 })
772
773 req := httptest.NewRequest(http.MethodGet, "/v1/foo%252Fbar", nil)
774 w := httptest.NewRecorder()
775 r.ServeHTTP(w, req)
776}
777
778func TestEngineHandleContextUseEscapedPathOverride(t *testing.T) {
779 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