mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-11-04 06:24:11 +01:00 
			
		
		
		
	Fix JSON Header response (#14499)
This commit is contained in:
		
							parent
							
								
									fe5266a25b
								
							
						
					
					
						commit
						a7cfb9f2c3
					
				@ -356,8 +356,8 @@ func (ctx *Context) Error(status int, contents ...string) {
 | 
			
		||||
 | 
			
		||||
// JSON render content as JSON
 | 
			
		||||
func (ctx *Context) JSON(status int, content interface{}) {
 | 
			
		||||
	ctx.Resp.WriteHeader(status)
 | 
			
		||||
	ctx.Resp.Header().Set("Content-Type", "application/json;charset=utf8")
 | 
			
		||||
	ctx.Resp.WriteHeader(status)
 | 
			
		||||
	if err := json.NewEncoder(ctx.Resp).Encode(content); err != nil {
 | 
			
		||||
		ctx.ServerError("Render JSON failed", err)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user