0
Fork 0
mirror of https://github.com/ninenines/cowboy.git synced 2025-07-15 20:50:24 +00:00

Merge branch 'dsucher-better-routes-without-start-slash-error'

This commit is contained in:
Loïc Hoguin 2013-11-08 22:56:21 +01:00
commit 1e892e2e3b

View file

@ -92,7 +92,10 @@ compile_paths([{<< $/, PathMatch/binary >>, Constraints, Handler, Opts}|Tail],
Acc) ->
PathRules = compile_rules(PathMatch, $/, [], [], <<>>),
Paths = [{lists:reverse(R), Constraints, Handler, Opts} || R <- PathRules],
compile_paths(Tail, Paths ++ Acc).
compile_paths(Tail, Paths ++ Acc);
compile_paths([{PathMatch, _, _, _}|_], _) ->
error({badarg, "The following route MUST begin with a slash: "
++ binary_to_list(PathMatch)}).
compile_rules(<<>>, _, Segments, Rules, <<>>) ->
[Segments|Rules];