From f3d6b05b863fe177a34a8a6ba48c5f263ef8cf82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Sun, 29 Oct 2017 19:52:27 +0000 Subject: Add cowboy_req:inform/2,3 User code can now send as many 1xx responses as necessary. --- doc/src/guide/resp.asciidoc | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'doc/src/guide') 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">> => <<"; rel=preload; as=style">>, + <<"link">> => <<"; rel=preload; as=script">> +}, Req0). +---- + === Push The HTTP/2 protocol introduced the ability to push resources -- cgit v1.2.3