Skip to content

Commit

Permalink
fix: auth reponse code with body
Browse files Browse the repository at this point in the history
  • Loading branch information
DDDHuang committed Jul 12, 2023
1 parent a5b3971 commit c61a5b8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/minirest.erl
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ apply_handler(Req, Path, #{mfargs := MFArgs, options := #{authorization := {Mod,
false ->
cowboy_req:reply(401, #{<<"WWW-Authenticate">> => <<"Basic Realm=\"minirest-server\"">>},
<<"UNAUTHORIZED">>, Req);
{reply, Code, Body} ->
cowboy_req:reply(Code, #{}, Body, Req);
{error, {lock_user, ResponseBody}} ->
cowboy_req:reply(401, #{}, ResponseBody, Req)
end;
Expand All @@ -174,6 +176,8 @@ apply_handler(Req, Path, #{mfargs := MFArgs, options := #{authorization := AuthF
false ->
cowboy_req:reply(401, #{<<"WWW-Authenticate">> => <<"Basic Realm=\"minirest-server\"">>},
<<"UNAUTHORIZED">>, Req);
{reply, Code, Body} ->
cowboy_req:reply(Code, #{}, Body, Req);
{error, {lock_user, ResponseBody}} ->
cowboy_req:reply(401, #{}, ResponseBody, Req)
end;
Expand Down

0 comments on commit c61a5b8

Please sign in to comment.