requires 'match', 'match_captures', 'list_extra_info';
-around ['match','match_captures'] => sub {
- my ($orig, $self, $ctx, @args) = @_;
- my $expected = $ctx->req->method;
- return $self->_has_expected_http_method($expected) ?
- $self->$orig($ctx, @args) :
- 0;
-};
-
+sub allowed_http_methods { @{shift->attributes->{Method}||[]} }
sub _has_expected_http_method {
my ($self, $expected) = @_;
1 : 0;
}
-sub allowed_http_methods { @{shift->attributes->{Method}||[]} }
+around ['match','match_captures'] => sub {
+ my ($orig, $self, $ctx, @args) = @_;
+ return 0 unless $self->$orig($ctx, @args);
+
+ my $expected = $ctx->req->method;
+ warn $expected;
+ return $self->_has_expected_http_method($expected);
+};
around 'list_extra_info' => sub {
my ($orig, $self, @args) = @_;
sub chain_base2 :Chained(/) CaptureArgs(1) { }
- sub chained_zero_post2 :POST Chained(chain_base2) PathPart('') Args(0) { $_[1]->res->body('chained_zero_post2') }
+ sub chained_zero_again : Chained(chain_base2) PathPart('') Args(0) { $_[1]->res->body('chained_zero_again') }
+ sub chained_zero_post2 : Chained(chain_base2) PathPart('') Args(0) { $_[1]->res->body('chained_zero_post2') }
sub chained_zero2 : Chained(chain_base2) PathPart('') Args(0) { $_[1]->res->body('chained_zero2') }
- sub chained_zero_post3 :POST Chained(chain_base2) PathPart('') Args(1) { $_[1]->res->body('chained_zero_post3') }
+ sub chained_zero_post3 : Chained(chain_base2) PathPart('') Args(1) { $_[1]->res->body('chained_zero_post3') }
sub chained_zero3 : Chained(chain_base2) PathPart('') Args(1) { $_[1]->res->body('chained_zero3') }
is $res->content, 'finally2';
}
-=over
-
-| /chain_base/* | /chain_base (1) |
-| | => /chained_zero (0) |
-| /chain_base/* | /chain_base (1) |
-| | => POST /chained_zero_post (0)
-
-=cut
{
my $res = request PUT '/chain_base2/capture/1';
- is $res->content, 'chained_zero3';
+ is $res->content, 'chained_zero3', "request PUT '/chain_base2/capture/1'";
}
{
my $res = request '/chain_base2/capture/1';
- is $res->content, 'chained_zero3';
+ is $res->content, 'chained_zero3', "request '/chain_base2/capture/1'";
}
{
my $res = request POST '/chain_base2/capture/1';
- is $res->content, 'chained_zero3';
+ is $res->content, 'chained_zero3', "request POST '/chain_base2/capture/1'";
}
{
my $res = request PUT '/chain_base2/capture';
- is $res->content, 'chained_zero2';
+ is $res->content, 'chained_zero2', "request PUT '/chain_base2/capture'";
}
{
my $res = request '/chain_base2/capture';
- is $res->content, 'chained_zero2';
+ is $res->content, 'chained_zero2', "request '/chain_base2/capture'";
}
{
my $res = request POST '/chain_base2/capture';
- is $res->content, 'chained_zero2';
+ is $res->content, 'chained_zero2', "request POST '/chain_base2/capture'";
}
=over