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

Function TestContextRenderRedirectWithRelativePath

context_test.go:1553–1565  ·  view source on GitHub ↗

TODO

(t *testing.T)

Source from the content-addressed store, hash-verified

1551
1552// TODO
1553func TestContextRenderRedirectWithRelativePath(t *testing.T) {
1554 w := httptest.NewRecorder()
1555 c, _ := CreateTestContext(w)
1556
1557 c.Request, _ = http.NewRequest(http.MethodPost, "http://example.com", nil)
1558 assert.Panics(t, func() { c.Redirect(299, "/new_path") })
1559 assert.Panics(t, func() { c.Redirect(309, "/new_path") })
1560
1561 c.Redirect(http.StatusMovedPermanently, "/path")
1562 c.Writer.WriteHeaderNow()
1563 assert.Equal(t, http.StatusMovedPermanently, w.Code)
1564 assert.Equal(t, "/path", w.Header().Get("Location"))
1565}
1566
1567func TestContextRenderRedirectWithAbsolutePath(t *testing.T) {
1568 w := httptest.NewRecorder()

Callers

nothing calls this directly

Calls 5

CreateTestContextFunction · 0.85
RedirectMethod · 0.80
WriteHeaderNowMethod · 0.65
GetMethod · 0.45
HeaderMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…