Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/routing_tree.erl
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,12 @@ wildcard_binary_lookup_test() ->
Expected = {ok, #{}, "ONE", [<<"is">>, <<"amazing">>]},
?assertEqual(Expected, C).

dash_in_path_test() ->
A = new(#{convert_to_binary => true}),
B = insert('_', "/my-test-route", "GET", "ONE", A),
C = lookup(<<"My host">>, <<"/my-test-route">>, "GET", B),
Expected = {ok, #{}, "ONE"},
?assertEqual(Expected, C).



Expand Down
11 changes: 2 additions & 9 deletions src/routing_tree_parser.yrl
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Nonterminals url_path path_segment query basic_element.
Nonterminals path_segment query basic_element.

Terminals 'divider' 'binding' 'wildcard' 'segment' 'query_start' 'ampersand' 'equals'.

Rootsymbol url_path.
Rootsymbol path_segment.


basic_element ->
Expand All @@ -26,11 +26,4 @@ path_segment ->
path_segment ->
'divider' basic_element path_segment: ['$2'|'$3'].

%% Remove trailing slash
url_path ->
path_segment 'divider': '$1'.
url_path ->
path_segment: '$1'.


Erlang code.