Skip to content

Commit

Permalink
Add default_method parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
dshadow authored and Viacheslav Tykhanovskyi committed Jan 16, 2017
1 parent 77675ab commit 9d1791a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions lib/Routes/Tiny.pm
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ sub new {
bless $self, $class;

$self->{strict_trailing_slash} = $params{strict_trailing_slash};
$self->{default_method} = $params{default_method};

$self->{parent_pattern} = undef;
$self->{patterns} = [];
Expand All @@ -33,6 +34,7 @@ sub add_route {

$pattern = $self->_build_pattern(
strict_trailing_slash => $self->{strict_trailing_slash},
default_method => $self->{default_method},
routes => $self,
pattern => $pattern,
@args
Expand Down
2 changes: 1 addition & 1 deletion lib/Routes/Tiny/Pattern.pm
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ sub new {
$self->{name} = $params{name};
$self->{defaults} = $params{defaults};
$self->{arguments} = $params{arguments};
$self->{method} = $params{method};
$self->{method} = $params{method} || $params{default_method};
$self->{pattern} = $params{pattern};
$self->{constraints} = $params{constraints} || {};
$self->{routes} = $params{routes};
Expand Down

0 comments on commit 9d1791a

Please sign in to comment.