aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2017-10-13 23:20:49 +0200
committerLoïc Hoguin <[email protected]>2017-10-13 23:20:49 +0200
commitf104da9322f83361e5bdb8bec0f396f8ad824798 (patch)
tree3289602e3d2383eb17aa4c1bb617fa6e271d1024 /doc
parentd3f15cfd8b2bb4c0c697bd995dfa4546474235ad (diff)
downloadcowboy-f104da9322f83361e5bdb8bec0f396f8ad824798.tar.gz
cowboy-f104da9322f83361e5bdb8bec0f396f8ad824798.tar.bz2
cowboy-f104da9322f83361e5bdb8bec0f396f8ad824798.zip
Small guide fixes
Diffstat (limited to 'doc')
-rw-r--r--doc/src/guide/resource_design.asciidoc4
-rw-r--r--doc/src/guide/ws_handlers.asciidoc15
2 files changed, 10 insertions, 9 deletions
diff --git a/doc/src/guide/resource_design.asciidoc b/doc/src/guide/resource_design.asciidoc
index 2325b9f..fa0c612 100644
--- a/doc/src/guide/resource_design.asciidoc
+++ b/doc/src/guide/resource_design.asciidoc
@@ -193,8 +193,8 @@ callback.
If you implement the methods PUT, POST and/or PATCH,
you must implement the `content_types_accepted` callback,
-and one `AcceptResource` callback for each content-type
-it returns. Prefix the `AcceptResource` callback names
+and one `AcceptCallback` callback for each content-type
+it returns. Prefix the `AcceptCallback` callback names
with `from_` for clarity. For example, `from_html` or
`from_json`.
diff --git a/doc/src/guide/ws_handlers.asciidoc b/doc/src/guide/ws_handlers.asciidoc
index 84dfb9b..a79d7e2 100644
--- a/doc/src/guide/ws_handlers.asciidoc
+++ b/doc/src/guide/ws_handlers.asciidoc
@@ -57,18 +57,19 @@ be:
[source,erlang]
----
-init(Req, State) ->
- case cowboy_req:parse_header(<<"sec-websocket-protocol">>, Req) of
+init(Req0, State) ->
+ case cowboy_req:parse_header(<<"sec-websocket-protocol">>, Req0) of
undefined ->
- {cowboy_websocket, Req, State};
+ {cowboy_websocket, Req0, State};
Subprotocols ->
case lists:keymember(<<"mqtt">>, 1, Subprotocols) of
true ->
- Req2 = cowboy_req:set_resp_header(<<"sec-websocket-protocol">>,
- <<"mqtt">>, Req),
- {cowboy_websocket, Req2, State};
+ Req = cowboy_req:set_resp_header(<<"sec-websocket-protocol">>,
+ <<"mqtt">>, Req0),
+ {cowboy_websocket, Req, State};
false ->
- {stop, Req, State}
+ Req = cowboy_req:reply(400, Req0),
+ {ok, Req, State}
end
end.
----