aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2013-11-08 22:56:21 +0100
committerLoïc Hoguin <[email protected]>2013-11-08 22:56:21 +0100
commit1e892e2e3bb18bbf7233be0dd66517d6f45e7329 (patch)
tree0bc0a4f894ad93e34e0f85485c69461e53573deb
parenta485e152ebb449773b92a2ca7557b3c7e495c530 (diff)
parent37e98f019ddf789c8523035f59ee4c43858db583 (diff)
downloadcowboy-1e892e2e3bb18bbf7233be0dd66517d6f45e7329.tar.gz
cowboy-1e892e2e3bb18bbf7233be0dd66517d6f45e7329.tar.bz2
cowboy-1e892e2e3bb18bbf7233be0dd66517d6f45e7329.zip
Merge branch 'dsucher-better-routes-without-start-slash-error'
-rw-r--r--src/cowboy_router.erl5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/cowboy_router.erl b/src/cowboy_router.erl
index e52b70b..16af2d4 100644
--- a/src/cowboy_router.erl
+++ b/src/cowboy_router.erl
@@ -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];