diff options
author | Avdhut <[email protected]> | 2022-09-02 09:37:52 +0530 |
---|---|---|
committer | GitHub <[email protected]> | 2022-09-01 22:07:52 -0600 |
commit | 66959d9f18768beb9531d51241978731bff8a305 (patch) | |
tree | 786b87ea73b781ca7b586c632690aab4880b445e | |
parent | f2a7e7c966c42b3a09bc8414136af0439fd7b630 (diff) | |
download | caddy-66959d9f18768beb9531d51241978731bff8a305.tar.gz caddy-66959d9f18768beb9531d51241978731bff8a305.zip |
templates: Document `httpError` function (#4972)
* added the httpError function into the document
* Update templates.go
* Update templates.go
* Fix gofmt
Co-authored-by: Matt Holt <[email protected]>
-rw-r--r-- | modules/caddyhttp/templates/templates.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/modules/caddyhttp/templates/templates.go b/modules/caddyhttp/templates/templates.go index 40e5bbeb1..29d165070 100644 --- a/modules/caddyhttp/templates/templates.go +++ b/modules/caddyhttp/templates/templates.go @@ -189,6 +189,14 @@ func init() { // {{.RespHeader.Set "Field-Name" "val"}} // ``` // +// ##### `httpError` +// +// Returns an error with the given status code to the HTTP handler chain. +// +// ``` +// {{if not (fileExists $includedFile)}}{{httpError 404}}{{end}} +// ``` +// // ##### `splitFrontMatter` // // Splits front matter out from the body. Front matter is metadata that appears at the very beginning of a file or string. Front matter can be in YAML, TOML, or JSON formats: |