Skip to content

Commit

Permalink
Deprecated (undocumented anyway) raw_uri infavor of base and request_…
Browse files Browse the repository at this point in the history
…uri.
  • Loading branch information
miyagawa committed Jan 27, 2010
1 parent 8d07f70 commit 9f269c8
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 26 deletions.
16 changes: 10 additions & 6 deletions lib/Plack/Request.pm
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ sub upload {
return $self->uploads->get_all($key);
}

sub raw_uri {
sub base {
my $self = shift;

my $env = $self->env;
Expand All @@ -200,16 +200,20 @@ sub raw_uri {
};

my $uri = "$scheme\://$host" . $env->{REQUEST_URI};
return URI->new($uri);
$uri = URI->new($uri);
$uri->path_query($self->env->{SCRIPT_NAME} || "/");

return $uri;
}

sub base {
sub raw_uri {
my $self = shift;
_deprecated 'base';

my $uri = $self->raw_uri;
$uri->path_query($self->env->{SCRIPT_NAME} || "/");
my $base = $self->base;
$base->path_query($self->env->{REQUEST_URI});

return $uri;
$base;
}

sub uri {
Expand Down
20 changes: 0 additions & 20 deletions t/Plack-Request/raw_uri.t

This file was deleted.

22 changes: 22 additions & 0 deletions t/Plack-Request/request_uri.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
use strict;
use Test::More;
use Plack::Request;
use Plack::Test;
use HTTP::Request::Common;

my $app = sub {
my $req = Plack::Request->new(shift);
return [ 200, [], [ $req->request_uri ] ];
};

test_psgi $app, sub {
my $cb = shift;

my $res = $cb->(GET "http://localhost/foo%20bar");
is $res->content, '/foo%20bar';

$res = $cb->(GET "http://localhost:2020/FOO/bar,baz");
is $res->content, '/FOO/bar,baz';
};

done_testing;

0 comments on commit 9f269c8

Please sign in to comment.