mirror of
				https://github.com/caddyserver/caddy.git
				synced 2025-11-04 03:27:23 -05:00 
			
		
		
		
	Allow responseRecorder to be nil
This commit is contained in:
		
							parent
							
								
									2aa958e058
								
							
						
					
					
						commit
						082ae70d1d
					
				@ -53,9 +53,11 @@ func NewReplacer(r *http.Request, rr *responseRecorder) replacer {
 | 
			
		||||
		"{when}": func() string {
 | 
			
		||||
			return time.Now().Format(timeFormat)
 | 
			
		||||
		}(),
 | 
			
		||||
		"{status}":  strconv.Itoa(rr.status),
 | 
			
		||||
		"{size}":    strconv.Itoa(rr.size),
 | 
			
		||||
		"{latency}": time.Since(rr.start).String(),
 | 
			
		||||
	}
 | 
			
		||||
	if rr != nil {
 | 
			
		||||
		rep["{status}"] = strconv.Itoa(rr.status)
 | 
			
		||||
		rep["{size}"] = strconv.Itoa(rr.size)
 | 
			
		||||
		rep["{latency}"] = time.Since(rr.start).String()
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// Header placeholders
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user