Пример #1
0
// WithPermanentRedirect responds with a redirection to the specific path or URL with the
// http.StatusMovedPermanently status.
func (r *GowebHTTPResponder) WithPermanentRedirect(ctx context.Context, pathOrURLSegments ...interface{}) error {
	ctx.HttpResponseWriter().Header().Set("Location", paths.PathFromSegments(pathOrURLSegments...))
	return r.WithStatus(ctx, http.StatusMovedPermanently)
}
Пример #2
0
// RedirectTo writes the Location header.
func RedirectTo(response http.ResponseWriter, pathOrURLSegments ...interface{}) {
	response.Header().Set(headerKeyLocation, paths.PathFromSegments(pathOrURLSegments...))
}