diff options
| author | franck cuny <franck@lumberjaph.net> | 2010-04-27 18:47:49 +0200 |
|---|---|---|
| committer | franck cuny <franck@lumberjaph.net> | 2010-04-27 18:47:49 +0200 |
| commit | 2ae3fd059b5aaf093c7fb26e674833b65008ad42 (patch) | |
| tree | c62d4d46851bfff1db49a734e1fb315d90ce2e40 /t | |
| parent | tests (diff) | |
| download | plack-middleware-throttle-2ae3fd059b5aaf093c7fb26e674833b65008ad42.tar.gz | |
change how path works, by default the whole application is throttled, but if path is specified, only this path will be throttled
Diffstat (limited to 't')
| -rw-r--r-- | t/05_filter_path.t | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/t/05_filter_path.t b/t/05_filter_path.t index 73ec24b..1be3706 100644 --- a/t/05_filter_path.t +++ b/t/05_filter_path.t @@ -11,7 +11,7 @@ my $handler = builder { enable "Throttle::Hourly", max => 1, backend => Plack::Middleware::Throttle::Backend::Hash->new(), - path => [qr/^\/foo/]; + path => qr{^/foo}; sub { [ '200', [ 'Content-Type' => 'text/html' ], ['hello world'] ] }; }; @@ -21,17 +21,17 @@ test_psgi my $cb = shift; { for ( 1 .. 2 ) { - my $req = GET "http://localhost/foo"; + my $req = GET "http://localhost/bar"; my $res = $cb->($req); is $res->content, 'hello world', 'content is valid'; ok !$res->header('X-RateLimit-Limit'), 'no header ratelimit'; } - my $req = GET "http://localhost/bar"; + my $req = GET "http://localhost/foo"; my $res = $cb->($req); is $res->content, 'hello world', 'content is valid'; ok $res->header('X-RateLimit-Limit'), 'header ratelimit'; - my $req = GET "http://localhost/bar"; - my $res = $cb->($req); + $req = GET "http://localhost/foo"; + $res = $cb->($req); is $res->code, 503, 'rate limit exceeded'; } }; |
