From 191ec27c261553c429cf5d6df2d14dce386417ff Mon Sep 17 00:00:00 2001 From: Matthew Holt Date: Thu, 25 Aug 2016 17:13:49 -0600 Subject: [PATCH] Clarify godoc for HTTP handler signature --- caddyhttp/httpserver/middleware.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/caddyhttp/httpserver/middleware.go b/caddyhttp/httpserver/middleware.go index 51a23593..91fbbf5b 100644 --- a/caddyhttp/httpserver/middleware.go +++ b/caddyhttp/httpserver/middleware.go @@ -21,17 +21,18 @@ type ( // Handler is like http.Handler except ServeHTTP may return a status // code and/or error. // - // If ServeHTTP writes to the response body, it should return a status - // code of 0. This signals to other handlers above it that the response - // body is already written, and that they should not write to it also. + // If ServeHTTP writes the response header, it should return a status + // code of 0. This signals to other handlers before it that the response + // is already handled, and that they should not write to it also. Keep + // in mind that writing to the response body writes the header, too. // // If ServeHTTP encounters an error, it should return the error value // so it can be logged by designated error-handling middleware. // - // If writing a response after calling another ServeHTTP method, the + // If writing a response after calling the next ServeHTTP method, the // returned status code SHOULD be used when writing the response. // - // If handling errors after calling another ServeHTTP method, the + // If handling errors after calling the next ServeHTTP method, the // returned error value SHOULD be logged or handled accordingly. // // Otherwise, return values should be propagated down the middleware