Skip to content
Open
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
5 changes: 4 additions & 1 deletion lib/Plack/Test.pm
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ to be a valid PSGI application code reference.

=item request

$res = $test->request($request);
$res = $test->request($request, %options);

takes an HTTP::Request object, runs it through the PSGI application to
test and returns an HTTP::Response object.
Expand Down Expand Up @@ -165,6 +165,9 @@ The available values for the backend are:
(Default) Creates a PSGI env hash out of HTTP::Request object, runs
the PSGI application in-process and returns HTTP::Response.

Custom PSGI environment variables can be passed using %options of the request()
method.

=item Server

Runs one of Plack::Handler backends (C<Standalone> by default) and
Expand Down
4 changes: 2 additions & 2 deletions lib/Plack/Test/MockHTTP.pm
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ sub new {
}

sub request {
my($self, $req) = @_;
my($self, $req) = (shift, shift);

$req->uri->scheme('http') unless defined $req->uri->scheme;
$req->uri->host('localhost') unless defined $req->uri->host;
my $env = $req->to_psgi;
my $env = $req->to_psgi(@_);

my $res = try {
HTTP::Response->from_psgi($self->{app}->($env));
Expand Down