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:
parent
9fb2d49b93
commit
f26f8d5afa
2 changed files with 14 additions and 7 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue