aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2018-11-02 12:36:51 +0100
committerLoïc Hoguin <[email protected]>2018-11-02 13:49:54 +0100
commit399b6a16b4a571e293437dcc8f85808f83b32ff6 (patch)
tree5b1d5b0e06b1f3bf08f1a858770ff00fe3c2fe3f /doc
parentd4dff2105500d960479d278981f42d42beb54175 (diff)
downloadcowboy-399b6a16b4a571e293437dcc8f85808f83b32ff6.tar.gz
cowboy-399b6a16b4a571e293437dcc8f85808f83b32ff6.tar.bz2
cowboy-399b6a16b4a571e293437dcc8f85808f83b32ff6.zip
Better handle content negotiation when accept contains charsets
Thanks to Philip Witty for help figuring this out.
Diffstat (limited to 'doc')
-rw-r--r--doc/src/manual/cowboy_rest.asciidoc20
1 files changed, 20 insertions, 0 deletions
diff --git a/doc/src/manual/cowboy_rest.asciidoc b/doc/src/manual/cowboy_rest.asciidoc
index 1b33bb8..19f4820 100644
--- a/doc/src/manual/cowboy_rest.asciidoc
+++ b/doc/src/manual/cowboy_rest.asciidoc
@@ -272,6 +272,16 @@ Cowboy treats all parameters as case sensitive, except for the
should therefore always provide the charset as a lowercase
binary string.
+When a charset is given in the media type parameters in the
+accept header, Cowboy will do some additional checks to confirm
+that it can use this charset. When the wildcard is used then Cowboy
+will immediately call `charsets_provided` to confirm the charset
+is acceptable. If the callback is undefined Cowboy assumes any
+charset is acceptable. When the wildcard is not used and the charset
+given in the accept header matches one of the configured media
+types Cowboy will use that charset and skip the `charsets_provided`
+step entirely.
+
Cowboy will add the negotiated `media_type` to the Req object
after this step completes:
@@ -284,6 +294,16 @@ req() :: #{
// @todo Case sensitivity of parsed mime content?
+Cowboy may also add the negotiated `charset` to the Req object
+after this step completes:
+
+[source,erlang]
+----
+req() :: #{
+ charset => binary() %% lowercase; case insensitive
+}
+----
+
=== delete_completed
[source,erlang]