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

Function TestRouteRawPath

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

Source from the content-addressed store, hash-verified

678}
679
680func TestRouteRawPath(t *testing.T) {
681 route := New()
682 route.UseRawPath = true
683
684 route.POST("/project/:name/build/:num", func(c *Context) {
685 name := c.Params.ByName("name")
686 num := c.Params.ByName("num")
687
688 assert.Equal(t, name, c.Param("name"))
689 assert.Equal(t, num, c.Param("num"))
690
691 assert.Equal(t, "Some/Other/Project", name)
692 assert.Equal(t, "222", num)
693 })
694
695 w := PerformRequest(route, http.MethodPost, "/project/Some%2FOther%2FProject/build/222")
696 assert.Equal(t, http.StatusOK, w.Code)
697}
698
699func TestRouteRawPathNoUnescape(t *testing.T) {
700 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