aboutsummaryrefslogtreecommitdiffstats
path: root/examples/rest_basic_auth
diff options
context:
space:
mode:
Diffstat (limited to 'examples/rest_basic_auth')
-rw-r--r--examples/rest_basic_auth/src/toppage_handler.erl7
1 files changed, 3 insertions, 4 deletions
diff --git a/examples/rest_basic_auth/src/toppage_handler.erl b/examples/rest_basic_auth/src/toppage_handler.erl
index 2914064..f5544f8 100644
--- a/examples/rest_basic_auth/src/toppage_handler.erl
+++ b/examples/rest_basic_auth/src/toppage_handler.erl
@@ -12,12 +12,11 @@ init(_Transport, _Req, []) ->
{upgrade, protocol, cowboy_rest}.
is_authorized(Req, State) ->
- {ok, Auth, Req1} = cowboy_req:parse_header(<<"authorization">>, Req),
- case Auth of
+ case cowboy_req:parse_header(<<"authorization">>, Req) of
{<<"basic">>, {User = <<"Alladin">>, <<"open sesame">>}} ->
- {true, Req1, User};
+ {true, Req, User};
_ ->
- {{false, <<"Basic realm=\"cowboy\"">>}, Req1, State}
+ {{false, <<"Basic realm=\"cowboy\"">>}, Req, State}
end.
content_types_provided(Req, State) ->