MCPcopy
hub / github.com/labstack/echo / Redirect

Method Redirect

context.go:732–739  ·  view source on GitHub ↗

Redirect redirects the request to a provided URL with status code.

(code int, url string)

Source from the content-addressed store, hash-verified

730
731// Redirect redirects the request to a provided URL with status code.
732func (c *Context) Redirect(code int, url string) error {
733 if code < 300 || code > 308 {
734 return ErrInvalidRedirectCode
735 }
736 c.response.Header().Set(HeaderLocation, url)
737 c.response.WriteHeader(code)
738 return nil
739}
740
741// Logger returns logger in Context
742func (c *Context) Logger() *slog.Logger {

Callers 6

TestContextRedirectFunction · 0.95
StaticDirectoryHandlerFunction · 0.80
ToMiddlewareMethod · 0.80
ToMiddlewareMethod · 0.80
ToMiddlewareMethod · 0.80

Calls 3

SetMethod · 0.80
HeaderMethod · 0.45
WriteHeaderMethod · 0.45

Tested by 2

TestContextRedirectFunction · 0.76