aboutsummaryrefslogtreecommitdiffstats
path: root/doc/src/guide/resp.asciidoc
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2016-09-14 18:51:11 +0200
committerLoïc Hoguin <[email protected]>2016-09-14 18:51:11 +0200
commit31cabe0fb98b4c75cb088761ba5ad53dbd2285ee (patch)
treef38d722f59530b0db689a4c06f5339620a1e5f6f /doc/src/guide/resp.asciidoc
parenta231216b07876293dbcfde020cb0228510c5064d (diff)
downloadcowboy-31cabe0fb98b4c75cb088761ba5ad53dbd2285ee.tar.gz
cowboy-31cabe0fb98b4c75cb088761ba5ad53dbd2285ee.tar.bz2
cowboy-31cabe0fb98b4c75cb088761ba5ad53dbd2285ee.zip
Use spaces in snippets in the guide
Diffstat (limited to 'doc/src/guide/resp.asciidoc')
-rw-r--r--doc/src/guide/resp.asciidoc14
1 files changed, 7 insertions, 7 deletions
diff --git a/doc/src/guide/resp.asciidoc b/doc/src/guide/resp.asciidoc
index b8ba7d5..1f6b318 100644
--- a/doc/src/guide/resp.asciidoc
+++ b/doc/src/guide/resp.asciidoc
@@ -71,7 +71,7 @@ Body = <<"Hats off!">>,
Req = cowboy_req:reply(200, #{
<<"content-type">> => <<"text/html">>
}, ["<html><head><title>", Title, "</title></head>",
- "<body><p>", Body, "</p></body></html>"], Req0).
+ "<body><p>", Body, "</p></body></html>"], Req0).
----
This method of building responses is more efficient than
@@ -247,7 +247,7 @@ To send a file while replying:
[source,erlang]
----
Req = cowboy_req:reply(200, #{
- <<"content-type">> => "image/png"
+ <<"content-type">> => "image/png"
}, {sendfile, 0, 12345, "path/to/logo.png"}, Req0).
----
@@ -289,13 +289,13 @@ in the response:
[source,erlang]
----
cowboy_req:push("/static/style.css", #{
- <<"accept">> => <<"text/css">>
+ <<"accept">> => <<"text/css">>
}, Req0),
Req = cowboy_req:reply(200, #{
- <<"content-type">> => <<"text/html">>
+ <<"content-type">> => <<"text/html">>
}, ["<html><head><title>My web page</title>",
- "<link rel='stylesheet' type='text/css' href='/static/style.css'>",
- "<body><p>Welcome to Erlang!</p></body></html>"], Req0).
+ "<link rel='stylesheet' type='text/css' href='/static/style.css'>",
+ "<body><p>Welcome to Erlang!</p></body></html>"], Req0).
----
To override the method, scheme, host, port or query string,
@@ -305,7 +305,7 @@ uses a different host name:
[source,erlang]
----
cowboy_req:push("/static/style.css", #{
- <<"accept">> => <<"text/css">>
+ <<"accept">> => <<"text/css">>
}, #{host => <<"cdn.example.org">>}, Req),
----