mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 16:40:24 +08:00 
			
		
		
		
	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:
		@@ -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 {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user