aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2018-11-02 15:31:54 +0100
committerLoïc Hoguin <[email protected]>2018-11-02 15:36:41 +0100
commit571719a164326eebdc792b43170fe27f123aac0d (patch)
tree59b5bb3ed45e1642bc772a66a11a39648df6a7b4 /doc
parent9569043bddd2ab1c31e198beb901fcba046b95c2 (diff)
downloadcowboy-571719a164326eebdc792b43170fe27f123aac0d.tar.gz
cowboy-571719a164326eebdc792b43170fe27f123aac0d.tar.bz2
cowboy-571719a164326eebdc792b43170fe27f123aac0d.zip
Add a charset option to cowboy_static
Diffstat (limited to 'doc')
-rw-r--r--doc/src/manual/cowboy_static.asciidoc20
1 files changed, 19 insertions, 1 deletions
diff --git a/doc/src/manual/cowboy_static.asciidoc b/doc/src/manual/cowboy_static.asciidoc
index a0069da..0e131dd 100644
--- a/doc/src/manual/cowboy_static.asciidoc
+++ b/doc/src/manual/cowboy_static.asciidoc
@@ -27,7 +27,10 @@ opts() :: {priv_file, App, Path}
App :: atom()
Path :: binary() | string()
-Extra :: [Etag | Mimetypes]
+Extra :: [Charset | Etag | Mimetypes]
+
+Charset :: {charset, module(), function()}
+ | {charset, binary()}
Etag :: {etag, module(), function()}
| {etag, false}
@@ -72,6 +75,20 @@ current directory.
The extra options allow you to define how the etag should be
calculated and how the MIME type of files should be detected.
+By default the static handler will not send a charset with
+the response. You can provide a specific charset that will
+be used for all files using the text media type, or provide
+a module and function that will be called when needed:
+
+[source,erlang]
+----
+detect_charset(Path :: binary()) -> Charset :: binary()
+----
+
+A charset must always be returned even if it doesn't make
+sense considering the media type of the file. A good default
+is `<<"utf-8">>`.
+
By default the static handler will generate an etag based
on the size and modification time of the file. You may disable
the etag entirely with `{etag, false}` or provide a module
@@ -112,6 +129,7 @@ when it fails to detect a file's MIME type.
== Changelog
+* *2.6*: The `charset` extra option was added.
* *1.0*: Handler introduced.
== Examples