From a28d5585f5f01e489534d388818a0ffad487740d Mon Sep 17 00:00:00 2001 From: Nimi Wariboko Jr Date: Sun, 3 May 2015 12:43:50 -0700 Subject: [PATCH] Export Replacer type --- middleware/replacer.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/middleware/replacer.go b/middleware/replacer.go index aea14bffc..d4818d92a 100644 --- a/middleware/replacer.go +++ b/middleware/replacer.go @@ -8,17 +8,21 @@ import ( "time" ) -// replacer is a type which can replace placeholder +// Replacer is a type which can replace placeholder // substrings in a string with actual values from a // http.Request and responseRecorder. Always use // NewReplacer to get one of these. +type Replacer interface { + Replace(string) string +} + type replacer map[string]string // NewReplacer makes a new replacer based on r and rr. // Do not create a new replacer until r and rr have all // the needed values, because this function copies those // values into the replacer. -func NewReplacer(r *http.Request, rr *responseRecorder) replacer { +func NewReplacer(r *http.Request, rr *responseRecorder) Replacer { rep := replacer{ "{method}": r.Method, "{scheme}": func() string {