Home / Function/ redirectRequest() — gin Function Reference

redirectRequest() — gin Function Reference

Architecture documentation for the redirectRequest() function in gin.go from the gin codebase.

Function go GinCore Context called by 2

Entity Profile

Dependency Diagram

graph TD
  4f102a15_dedc_8999_f9ea_96d2f4d455b4["redirectRequest()"]
  22068897_9e6c_d28e_6b96_439ffa67fe6e["gin.go"]
  4f102a15_dedc_8999_f9ea_96d2f4d455b4 -->|defined in| 22068897_9e6c_d28e_6b96_439ffa67fe6e
  e270acef_6155_8e19_218e_adc59e23a531["redirectTrailingSlash()"]
  e270acef_6155_8e19_218e_adc59e23a531 -->|calls| 4f102a15_dedc_8999_f9ea_96d2f4d455b4
  063aa440_2813_b064_23e9_a76bf780c989["redirectFixedPath()"]
  063aa440_2813_b064_23e9_a76bf780c989 -->|calls| 4f102a15_dedc_8999_f9ea_96d2f4d455b4
  style 4f102a15_dedc_8999_f9ea_96d2f4d455b4 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

gin.go lines 820–832

func redirectRequest(c *Context) {
	req := c.Request
	rPath := req.URL.Path
	rURL := req.URL.String()

	code := http.StatusMovedPermanently // Permanent redirect, request with GET method
	if req.Method != http.MethodGet {
		code = http.StatusTemporaryRedirect
	}
	debugPrint("redirecting request %d: %s --> %s", code, rPath, rURL)
	http.Redirect(c.Writer, req, rURL, code)
	c.writermem.WriteHeaderNow()
}

Domain

Subdomains

Defined In

Frequently Asked Questions

What does redirectRequest() do?
redirectRequest() is a function in the gin codebase, defined in gin.go.
Where is redirectRequest() defined?
redirectRequest() is defined in gin.go at line 820.
What calls redirectRequest()?
redirectRequest() is called by 2 function(s): redirectFixedPath, redirectTrailingSlash.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free