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

Function redirectRequest

gin.go:820–832  ·  view source on GitHub ↗
(c *Context)

Source from the content-addressed store, hash-verified

818}
819
820func redirectRequest(c *Context) {
821 req := c.Request
822 rPath := req.URL.Path
823 rURL := req.URL.String()
824
825 code := http.StatusMovedPermanently // Permanent redirect, request with GET method
826 if req.Method != http.MethodGet {
827 code = http.StatusTemporaryRedirect
828 }
829 debugPrint("redirecting request %d: %s --> %s", code, rPath, rURL)
830 http.Redirect(c.Writer, req, rURL, code)
831 c.writermem.WriteHeaderNow()
832}

Callers 2

redirectTrailingSlashFunction · 0.85
redirectFixedPathFunction · 0.85

Calls 4

debugPrintFunction · 0.85
RedirectMethod · 0.80
StringMethod · 0.65
WriteHeaderNowMethod · 0.65

Tested by

no test coverage detected