diff options
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 |