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

Function TestRouteRawPathNoUnescape

routes_test.go:699–717  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

697}
698
699func TestRouteRawPathNoUnescape(t *testing.T) {
700 route := New()
701 route.UseRawPath = true
702 route.UnescapePathValues = false
703
704 route.POST("/project/:name/build/:num", func(c *Context) {
705 name := c.Params.ByName("name")
706 num := c.Params.ByName("num")
707
708 assert.Equal(t, name, c.Param("name"))
709 assert.Equal(t, num, c.Param("num"))
710
711 assert.Equal(t, "Some%2FOther%2FProject", name)
712 assert.Equal(t, "333", num)
713 })
714
715 w := PerformRequest(route, http.MethodPost, "/project/Some%2FOther%2FProject/build/333")
716 assert.Equal(t, http.StatusOK, w.Code)
717}
718
719func TestRouteServeErrorWithWriteHeader(t *testing.T) {
720 route := New()

Callers

nothing calls this directly

Calls 5

NewFunction · 0.85
PerformRequestFunction · 0.85
ByNameMethod · 0.80
ParamMethod · 0.80
POSTMethod · 0.65

Tested by

no test coverage detected