From 56c629ef891e5ce6c570a602bb9c2fa2bc1813d7 Mon Sep 17 00:00:00 2001 From: Matt Holt Date: Sat, 25 Apr 2015 17:53:03 -0600 Subject: [PATCH] A few code corrections --- Writing-Middleware.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Writing-Middleware.md b/Writing-Middleware.md index b960c6b..92ad244 100644 --- a/Writing-Middleware.md +++ b/Writing-Middleware.md @@ -14,15 +14,15 @@ Handlers are usually a struct with at least one field, the next Handler in the c ```go type MyHandler struct { - Next middleware.HandlerFunc + Next middleware.Handler } ``` -It must implement the middleware.Handler interface. We do this by adding a method called ServeHTTP, which happens to be a middlware.HandlerFunc. Right now, let's just pass the request to the next Handler in the chain: +It must also implement the middleware.Handler interface. We do this by adding a method called ServeHTTP. Right now, let's just pass the request to the next Handler in the chain: ```go func (h MyHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) (int, error) { - return h.Next(w, r) + return h.Next.ServeHTTP(w, r) } ```