Plack:...y::Test(3pm)
π NAME π
ok so bestie, this is Plack::App::Proxy::Test β it's utilities to test Plack::App::Proxy. that's literally it. that's the whole job. π
β¨ SYNOPSIS β¨
test_proxy(
app => $backend_app,
proxy => sub { Plack::App::Proxy->new(remote => "http://$_[0]:$_[1]") },
client => sub {
my $cb = shift;
my $res = $cb->(GET '/');
ok $res->is_success, "Check the status line.";
},
);
like. look at that. three little keys and you're testing a whole proxy. it's giving main character energy fr. π
πΈ DESCRIPTION πΈ
Plack::App::Proxy::Test provids the test_proxy function, which wraps test_psgi from Plack::Test β simply. (and yes, "provids" is what the source says, we're not fixing it, it's iconic now π«Ά)
so basically: instead of you hand-rolling a whole test_psgi situation, this does the wrapping for you. lowkey the nicest thing anyone's ever done for a proxy test suite.
π₯ FUNCTIONS π₯
π test_proxy
test_proxy app => $app,
proxy => $proxy_cb->($app_host, $app_port),
client => $client_cb->($cb);
okay so here's the vibe. test_proxy runs two servers at once:
"app"β the origin server. this is your actual app, the one doing the real work.- the proxy server. this one's the middleman.
inside the "proxy" callback, it's your moment to shine: you create the proxy server instance that's gonna send requests over to the "app" server. no cap, that's your job there.
then the "client" callback gets called to run your tests. and here's the cute part β inside "client", all HTTP requests get sent to the "proxy" server. (and the proxy server will proxy your request to the app server.) so the request goes client β proxy β app and nobody has to think about it. obsessed. π
π AUTHOR π
Masahiro Honma <hiratara@cpan.org>
π¦ SEE ALSO π¦
Plack::App::ProxyPlack::Test
and that's the whole page bestie β this was Plack:...y::Test(3pm) from perl v5.32.0, dated 2021-01-09. go write some tests, you got this πβ¨
π¦ where this page comes from
- debian bookworm: libplack-app-proxy-perl 0.29-1.1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libplack-app-proxy-perl 0.29-1.1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu jammy: libplack-app-proxy-perl 0.29-1.1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libplack-app-proxy-perl 0.29-1.1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms