Test2::Tools::HTTP::Apps - App container class for Test2::Tools::HTTP
version 0.09
This acts as a container for zero or more PSGI applications that have been added using Test2::Tools::HTTP's psgi_app_add method. It is used by a user agent wrapper (Test2::Tools::HTTP::UA) class to dispatch requests to the correct PSGI app.
psgi_app_add
my $apps = Test2::Tools::HTTP::Apps->new;
This class is a singleton, so this always returns the same instance.
my $key = $apps->uri_key($url);
This function returns the URI key given a fully qualified URL. The key usually contains the schema, host and port but not the path or other components of the URI. The actual key format is subject to change and you should not depend on it.
$apps->add_psgi($uri, $app) = @_;
Add the given PSGI app to the container. The URI should specify the URL used to access the app.
$apps->del_psgi($uri);
Remove the app with the given URI from the container.
my $url = $apps->base_url;
This is the base URL used to qualify relative URLs. It is an instance of URI.
my $app = $apps->uri_to_app($uri);
Given a URL (possibly relative) this function returns the PSGI app for it. If there are no apps registered for the URL then it will return undef.
undef
my $tester = $apps->uri_to_tester;
Same as uri_to-tester except it returns the a Plack::Test wrapped around the PSGI application.
uri_to-tester
Graham Ollis <plicease@cpan.org>
This software is copyright (c) 2018 by Graham Ollis.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Test2::Tools::HTTP, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Test2::Tools::HTTP
CPAN shell
perl -MCPAN -e shell install Test2::Tools::HTTP
For more information on module installation, please visit the detailed CPAN module installation guide.