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

Function TestContextRenderRedirectWithAbsolutePath

context_test.go:1567–1577  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1565}
1566
1567func TestContextRenderRedirectWithAbsolutePath(t *testing.T) {
1568 w := httptest.NewRecorder()
1569 c, _ := CreateTestContext(w)
1570
1571 c.Request, _ = http.NewRequest(http.MethodPost, "http://example.com", nil)
1572 c.Redirect(http.StatusFound, "http://google.com")
1573 c.Writer.WriteHeaderNow()
1574
1575 assert.Equal(t, http.StatusFound, w.Code)
1576 assert.Equal(t, "http://google.com", w.Header().Get("Location"))
1577}
1578
1579func TestContextRenderRedirectWith201(t *testing.T) {
1580 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…