Test2::Tools::HTTP::Apps - App container class for Test2::Tools::HTTP
This acts as a container for zero or more PSGI applications that have been added using Test2::Tools::HTTP's
It is used by a user agent wrapper (Test2::Tools::HTTP::UA) class to dispatch requests to the correct PSGI app.
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.
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
my $tester = $apps->uri_to_tester;
uri_to-tester except it returns the a Plack::Test wrapped around the PSGI application.
Graham Ollis <email@example.com>
This software is copyright (c) 2018-2022 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.