|
@@ -157,7 +157,7 @@ compile_brackets_split(<< C, Rest/binary >>, Acc, N) ->
|
|
compile_brackets_split(Rest, << Acc/binary, C >>, N).
|
|
compile_brackets_split(Rest, << Acc/binary, C >>, N).
|
|
|
|
|
|
-spec execute(Req, Env)
|
|
-spec execute(Req, Env)
|
|
- -> {ok, Req, Env} | {error, 400 | 404, Req}
|
|
|
|
|
|
+ -> {ok, Req, Env} | {halt, Req}
|
|
when Req::cowboy_req:req(), Env::cowboy_middleware:env().
|
|
when Req::cowboy_req:req(), Env::cowboy_middleware:env().
|
|
execute(Req, Env) ->
|
|
execute(Req, Env) ->
|
|
{_, Dispatch} = lists:keyfind(dispatch, 1, Env),
|
|
{_, Dispatch} = lists:keyfind(dispatch, 1, Env),
|
|
@@ -168,11 +168,11 @@ execute(Req, Env) ->
|
|
Req2 = cowboy_req:set_bindings(HostInfo, PathInfo, Bindings, Req),
|
|
Req2 = cowboy_req:set_bindings(HostInfo, PathInfo, Bindings, Req),
|
|
{ok, Req2, [{handler, Handler}, {handler_opts, HandlerOpts}|Env]};
|
|
{ok, Req2, [{handler, Handler}, {handler_opts, HandlerOpts}|Env]};
|
|
{error, notfound, host} ->
|
|
{error, notfound, host} ->
|
|
- {error, 400, Req};
|
|
|
|
|
|
+ {halt, cowboy_req:reply(400, Req)};
|
|
{error, badrequest, path} ->
|
|
{error, badrequest, path} ->
|
|
- {error, 400, Req};
|
|
|
|
|
|
+ {halt, cowboy_req:reply(400, Req)};
|
|
{error, notfound, path} ->
|
|
{error, notfound, path} ->
|
|
- {error, 404, Req}
|
|
|
|
|
|
+ {halt, cowboy_req:reply(404, Req)}
|
|
end.
|
|
end.
|
|
|
|
|
|
%% Internal.
|
|
%% Internal.
|