0
Fork 0
mirror of https://github.com/caddyserver/caddy.git synced 2024-12-23 22:27:38 -05:00

Allow responseRecorder to be nil

This commit is contained in:
Nimi Wariboko Jr 2015-05-03 12:38:06 -07:00
parent 2aa958e058
commit 082ae70d1d

View file

@ -53,9 +53,11 @@ func NewReplacer(r *http.Request, rr *responseRecorder) replacer {
"{when}": func() string { "{when}": func() string {
return time.Now().Format(timeFormat) return time.Now().Format(timeFormat)
}(), }(),
"{status}": strconv.Itoa(rr.status), }
"{size}": strconv.Itoa(rr.size), if rr != nil {
"{latency}": time.Since(rr.start).String(), rep["{status}"] = strconv.Itoa(rr.status)
rep["{size}"] = strconv.Itoa(rr.size)
rep["{latency}"] = time.Since(rr.start).String()
} }
// Header placeholders // Header placeholders