diff options
author | Loïc Hoguin <[email protected]> | 2013-04-25 17:46:40 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2013-04-25 17:46:40 +0200 |
commit | beaae7bf7036d195bc775372e1d8de90d20d60bd (patch) | |
tree | 19212b3350101a77e9ad2a187abcdb312a215f36 /guide | |
parent | 690927d9bd0449feb93c9c7f613d2d9f1e808697 (diff) | |
download | cowboy-beaae7bf7036d195bc775372e1d8de90d20d60bd.tar.gz cowboy-beaae7bf7036d195bc775372e1d8de90d20d60bd.tar.bz2 cowboy-beaae7bf7036d195bc775372e1d8de90d20d60bd.zip |
Document meta values set by REST
You can use these values to perform a reply using the negotiated
content-type and language for non-HEAD/GET methods.
Diffstat (limited to 'guide')
-rw-r--r-- | guide/rest_handlers.md | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/guide/rest_handlers.md b/guide/rest_handlers.md index d5997f9..ac11d98 100644 --- a/guide/rest_handlers.md +++ b/guide/rest_handlers.md @@ -106,6 +106,19 @@ each function. For example, `from_html` and `to_html` indicate in the first case that we're accepting a resource given as HTML, and in the second case that we send one as HTML. +Cowboy will set informative meta values at various points of the +execution. You can retrieve them using `cowboy_req:meta/{2,3}`. +The values are defined in the following table. + +| Meta key | Details | +| -----------| ---------------------------------------------------- | +| media_type | The content-type negotiated for the response entity. | +| language | The language negotiated for the response entity. | +| charset | The charset negotiated for the response entity. | + +They can be used to reply a response entity to a request with +an idempotent method (`POST`, `PUT`, `PATCH`, `DELETE`). + Usage ----- |