diff options
author | Loïc Hoguin <[email protected]> | 2017-10-29 19:52:27 +0000 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2017-10-29 21:03:04 +0000 |
commit | f3d6b05b863fe177a34a8a6ba48c5f263ef8cf82 (patch) | |
tree | fc3235ad43880f29186bce373a3c79057c83e060 /doc/src/guide | |
parent | f4331f7c169309c9017b9628fe3757fc5312270b (diff) | |
download | cowboy-f3d6b05b863fe177a34a8a6ba48c5f263ef8cf82.tar.gz cowboy-f3d6b05b863fe177a34a8a6ba48c5f263ef8cf82.tar.bz2 cowboy-f3d6b05b863fe177a34a8a6ba48c5f263ef8cf82.zip |
Add cowboy_req:inform/2,3
User code can now send as many 1xx responses as necessary.
Diffstat (limited to 'doc/src/guide')
-rw-r--r-- | doc/src/guide/resp.asciidoc | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/doc/src/guide/resp.asciidoc b/doc/src/guide/resp.asciidoc index 2eaa804..6d4967e 100644 --- a/doc/src/guide/resp.asciidoc +++ b/doc/src/guide/resp.asciidoc @@ -262,6 +262,29 @@ Req = cowboy_req:reply(200, #{ // example would be automatic concatenation of CSS or JS // files. +=== Informational responses + +Cowboy allows you to send informational responses. + +Informational responses are responses that have a status +code between 100 and 199. Any number can be sent before +the proper response. Sending an informational response +does not change the behavior of the proper response, and +clients are expected to ignore any informational response +they do not understand. + +The following snippet sends a 103 informational response +with some headers that are expected to be in the final +response. + +[source,erlang] +---- +Req = cowboy_req:inform(103, #{ + <<"link">> => <<"</style.css>; rel=preload; as=style">>, + <<"link">> => <<"</script.js>; rel=preload; as=script">> +}, Req0). +---- + === Push The HTTP/2 protocol introduced the ability to push resources |