1
0
Fork 0
forked from forgejo/forgejo

Set Content-Type to text/plain for http status 401

This is because git command line shows the failure reason only if Content-Type is text/plain.
This commit is contained in:
Linquize 2015-03-28 22:30:05 +08:00
parent 9fb2d49b93
commit f26f8d5afa
2 changed files with 14 additions and 7 deletions

View file

@ -139,6 +139,13 @@ func (ctx *Context) Handle(status int, title string, err error) {
ctx.HTML(status, base.TplName(fmt.Sprintf("status/%d", status)))
}
func (ctx *Context) HandleText(status int, title string) {
if (status / 100 == 4) || (status / 100 == 5) {
log.Error(4, "%s", title)
}
ctx.RenderData(status, []byte(title))
}
func (ctx *Context) HandleAPI(status int, obj interface{}) {
var message string
if err, ok := obj.(error); ok {