1 Star 0 Fork 0

nqlite / ngossip

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
redirect.go 649 Bytes
一键复制 编辑 原始数据 按行查看 历史
jiaweicheng 提交于 2024-02-16 13:42 . update *
package http
type redirect struct {
URL string
Code int
}
func (r *redirect) Redirect() (string, int) {
return r.URL, r.Code
}
// NewRedirect new a redirect with url, which may be a path relative to the request path.
// The provided code should be in the 3xx range and is usually StatusMovedPermanently, StatusFound or StatusSeeOther.
// If the Content-Type header has not been set, Redirect sets it to "text/html; charset=utf-8" and writes a small HTML body.
// Setting the Content-Type header to any value, including nil, disables that behavior.
func NewRedirect(url string, code int) Redirector {
return &redirect{URL: url, Code: code}
}
1
https://gitee.com/nqlite/ngossip.git
git@gitee.com:nqlite/ngossip.git
nqlite
ngossip
ngossip
e110283f372f

搜索帮助