diff options
Diffstat (limited to 'docs/en/cowboy/2.2/guide/resp/index.html')
-rw-r--r-- | docs/en/cowboy/2.2/guide/resp/index.html | 40 |
1 files changed, 21 insertions, 19 deletions
diff --git a/docs/en/cowboy/2.2/guide/resp/index.html b/docs/en/cowboy/2.2/guide/resp/index.html index eec9c9ff..0d1fbdd1 100644 --- a/docs/en/cowboy/2.2/guide/resp/index.html +++ b/docs/en/cowboy/2.2/guide/resp/index.html @@ -7,7 +7,7 @@ <meta name="description" content=""> <meta name="author" content="Loïc Hoguin based on a design from (Soft10) Pol Cámara"> - <meta name="generator" content="Hugo 0.30.2" /> + <meta name="generator" content="Hugo 0.37.1" /> <title>Nine Nines: Sending a response</title> @@ -90,7 +90,7 @@ cases, Cowboy will add any headers required by the protocol <div class="paragraph"><p>When you need to set only the status code, use <code>cowboy_req:reply/2</code>:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -98,7 +98,7 @@ http://www.gnu.org/software/src-highlite --> <div class="paragraph"><p>When you need to set response headers at the same time, use <code>cowboy_req:reply/3</code>:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -110,7 +110,7 @@ binary.</p></div> <div class="paragraph"><p>When you also need to set the response body, use <code>cowboy_req:reply/4</code>:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -126,7 +126,7 @@ binaries, characters, strings or other iolists. This allows you to build a response from different parts without having to do any concatenation:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -151,7 +151,7 @@ Cowboy will add any required headers to the response.</p></div> <div class="paragraph"><p>When you need to set only the status code, use <code>cowboy_req:stream_reply/2</code>:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -168,7 +168,7 @@ not recommended. All responses with a body should have a content-type. The header can be set beforehand, or using the <code>cowboy_req:stream_reply/3</code>:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -195,7 +195,7 @@ body was fully generated.</p></div> <div class="paragraph"><p>Trailer fields must be listed in the trailer header. Any field not listed might be dropped by the client or an intermediary.</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -225,7 +225,7 @@ and sent as part of the response when a reply function is called.</p></div> <div class="paragraph"><p>To set response headers:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -235,7 +235,7 @@ http://www.gnu.org/software/src-highlite --> the <a href="../cookies">Cookies</a> chapter for more information.</p></div> <div class="paragraph"><p>To check if a response header has already been set:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -243,7 +243,7 @@ http://www.gnu.org/software/src-highlite --> <div class="paragraph"><p>It returns <code>true</code> if the header was set, <code>false</code> otherwise.</p></div> <div class="paragraph"><p>To delete a response header that was set previously:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -297,7 +297,7 @@ headers.</p></div> default sends the server header with the value "Cowboy". We can override it:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -314,14 +314,14 @@ immediately sending it. It is stored in the Req object and sent when the reply function is called.</p></div> <div class="paragraph"><p>To set the response body:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> <pre><tt><span style="color: #009900">Req</span> <span style="color: #990000">=</span> <span style="font-weight: bold"><span style="color: #000000">cowboy_req:set_resp_body</span></span>(<span style="color: #FF0000">"Hello world!"</span>, <span style="color: #009900">Req0</span>)<span style="color: #990000">.</span></tt></pre></div></div> <div class="paragraph"><p>To check if a response body has already been set:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -340,7 +340,7 @@ using <code>cowboy_req:reply/4</code>, or when presetting the response header, you can give a <code>sendfile</code> tuple to Cowboy:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -351,7 +351,7 @@ entire file may be sent, or just a part of it.</p></div> Cowboy sends it in the content-length header.</p></div> <div class="paragraph"><p>To send a file while replying:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -374,7 +374,7 @@ they do not understand.</p></div> with some headers that are expected to be in the final response.</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -404,7 +404,7 @@ string, set to empty) and the method is GET by default.</p></div> <div class="paragraph"><p>The following snippet pushes a CSS file that is linked to in the response:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -420,7 +420,7 @@ http://www.gnu.org/software/src-highlite --> simply pass in a fourth argument. The following snippet uses a different host name:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -491,6 +491,8 @@ ultimately send a response to the client.</p></div> + <li><a href="/docs/en/cowboy/2.3/guide">2.3</a></li> + <li><a href="/docs/en/cowboy/2.2/guide">2.2</a></li> <li><a href="/docs/en/cowboy/2.1/guide">2.1</a></li> |