mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-15 20:50:24 +00:00
Use spaces in snippets in the guide
This commit is contained in:
parent
a231216b07
commit
31cabe0fb9
10 changed files with 104 additions and 104 deletions
|
@ -32,15 +32,15 @@ otherwise.
|
|||
[source,erlang]
|
||||
----
|
||||
init(Req0=#{method := <<"GET">>}, State) ->
|
||||
Req = cowboy_req:reply(200, #{
|
||||
<<"content-type">> => <<"text/plain">>
|
||||
}, <<"Hello world!">>, Req0),
|
||||
{ok, Req, State};
|
||||
Req = cowboy_req:reply(200, #{
|
||||
<<"content-type">> => <<"text/plain">>
|
||||
}, <<"Hello world!">>, Req0),
|
||||
{ok, Req, State};
|
||||
init(Req0, State) ->
|
||||
Req = cowboy_req:reply(405, #{
|
||||
<<"allow">> => <<"GET">>
|
||||
}, Req0),
|
||||
{ok, Req, State}.
|
||||
Req = cowboy_req:reply(405, #{
|
||||
<<"allow">> => <<"GET">>
|
||||
}, Req0),
|
||||
{ok, Req, State}.
|
||||
----
|
||||
|
||||
Any other field is internal and should not be accessed.
|
||||
|
@ -135,11 +135,11 @@ of the effective request URI can all be retrieved directly:
|
|||
[source,erlang]
|
||||
----
|
||||
#{
|
||||
scheme := Scheme,
|
||||
host := Host,
|
||||
port := Port,
|
||||
path := Path,
|
||||
qs := Qs
|
||||
scheme := Scheme,
|
||||
host := Host,
|
||||
port := Port,
|
||||
path := Path,
|
||||
qs := Qs
|
||||
} = Req.
|
||||
----
|
||||
|
||||
|
@ -348,7 +348,7 @@ directly:
|
|||
[source,erlang]
|
||||
----
|
||||
ParsedVal = cowboy_req:parse_header(<<"content-type">>, Req,
|
||||
{<<"text">>, <<"plain">>, []}).
|
||||
{<<"text">>, <<"plain">>, []}).
|
||||
----
|
||||
|
||||
=== Peer
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue