0
Fork 0
mirror of https://github.com/ninenines/cowboy.git synced 2025-07-14 20:30:23 +00:00

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.
This commit is contained in:
Loïc Hoguin 2013-04-25 17:46:40 +02:00
parent 690927d9bd
commit beaae7bf70

View file

@ -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
-----