From 71ea7d8cd732fdcfda6bc537cb64cc7ccfe2fe7f Mon Sep 17 00:00:00 2001 From: Matt Holt Date: Wed, 3 May 2017 23:18:12 -0600 Subject: [PATCH] Directive convention --- Things-HTTP-Middleware-Developers-Should-Know.md | 1 + 1 file changed, 1 insertion(+) diff --git a/Things-HTTP-Middleware-Developers-Should-Know.md b/Things-HTTP-Middleware-Developers-Should-Know.md index 721d248..56fa176 100644 --- a/Things-HTTP-Middleware-Developers-Should-Know.md +++ b/Things-HTTP-Middleware-Developers-Should-Know.md @@ -6,3 +6,4 @@ - For anything else, use `httpserver.SafePath` to get a sanitized path - If you need to wrap or record the response, wrap your own `ResponseWriter` type with `httpserver.ResponseWriterWrapper` so it is guaranteed to implement some crucial interfaces. - The `http.Request.URL` (especially its `.Path` value) may be changed by other "rewriting" middlewares. You can always access the original incoming URL via context: `req.Context().Value(httpserver.OriginalURLCtxKey).(url.URL)` +- Directives (and subdirectives) follow `underscore_convention` for naming. Lower-cased, with underscore as word separators. There may be rare exceptions to this (e.g. the `header` directive uses header field names, like `Content-Type` as subdirectives), but usually try to follow this convention. It will make the user's experience with your middleware consistent with the rest of Caddy. Avoid `camelCase` or `hyphen-separation`. \ No newline at end of file