Export Replacer and use concrete type instead of interface

The interface was only making things difficult; a concrete pointer is
probably best.
This commit is contained in:
Matthew Holt
2019-12-29 13:12:52 -07:00
parent 2b33d9a5e5
commit 95d944613b
19 changed files with 128 additions and 134 deletions

View File

@ -451,7 +451,7 @@ func (*HTTPErrorConfig) WithError(r *http.Request, err error) *http.Request {
r = r.WithContext(c)
// add error values to the replacer
repl := r.Context().Value(caddy.ReplacerCtxKey).(caddy.Replacer)
repl := r.Context().Value(caddy.ReplacerCtxKey).(*caddy.Replacer)
repl.Set("http.error", err.Error())
if handlerErr, ok := err.(HandlerError); ok {
repl.Set("http.error.status_code", strconv.Itoa(handlerErr.StatusCode))