diff options
author | Loïc Hoguin <[email protected]> | 2025-02-11 12:00:03 +0100 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2025-02-11 13:28:45 +0100 |
commit | e8a1868033a75fa1f684a8b91ff7aa25e6c67676 (patch) | |
tree | 06abf00b254033dd36a43730e3fa37f50b4c9eaa /doc/src | |
parent | f316a65906d97609c7a3f317c0b1dea95fc37e6c (diff) | |
download | cowboy-e8a1868033a75fa1f684a8b91ff7aa25e6c67676.tar.gz cowboy-e8a1868033a75fa1f684a8b91ff7aa25e6c67676.tar.bz2 cowboy-e8a1868033a75fa1f684a8b91ff7aa25e6c67676.zip |
Add support for lists in cowboy_req:set_resp_headers
This is meant to be used with clients such as Gun to simplify
proxying and similar operations. The set-cookie header must
not be set this way so there is still some extra processing
to be done to fully translate a Gun response into a Cowboy
response.
Diffstat (limited to 'doc/src')
-rw-r--r-- | doc/src/manual/cowboy_req.set_resp_headers.asciidoc | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/doc/src/manual/cowboy_req.set_resp_headers.asciidoc b/doc/src/manual/cowboy_req.set_resp_headers.asciidoc index 63fe424..9ca5901 100644 --- a/doc/src/manual/cowboy_req.set_resp_headers.asciidoc +++ b/doc/src/manual/cowboy_req.set_resp_headers.asciidoc @@ -11,7 +11,7 @@ cowboy_req:set_resp_headers - Set several response headers set_resp_headers(Headers, Req :: cowboy_req:req()) -> Req -Headers :: cowboy:http_headers() +Headers :: cowboy:http_headers() | [{binary(), iodata()}] ---- Set several headers to be sent with the response. @@ -32,8 +32,16 @@ instead of this function to set cookies. Headers:: -Headers as a map with keys being lowercase binary strings, -and values as binary strings. +Headers as a map with names being lowercase binary strings, +and values as iodata; or as a list with the same requirements +for names and values. ++ +When a list is given it is converted to its equivalent map, +with duplicate headers concatenated with a comma inserted +in-between. Support for lists is meant to simplify using +data from clients or other applications. ++ +The set-cookie header must not be set using this function. Req:: @@ -48,6 +56,7 @@ otherwise the headers will not be sent in the response. == Changelog +* *2.13*: The function now accepts a list of headers. * *2.0*: Function introduced. == Examples |