diff --git a/t/mojolicious/proxy_app.t b/t/mojolicious/proxy_app.t index 7a80fe7937..1eadb6dbdd 100644 --- a/t/mojolicious/proxy_app.t +++ b/t/mojolicious/proxy_app.t @@ -101,23 +101,28 @@ get '/proxy3/:method/*target' => sub { my $t = Test::Mojo->new; -# Various response variants -$t->get_ok('/proxy1/res1')->status_is(200)->header_is('X-Mojo-App' => 'One')->content_is('One!'); -$t->get_ok('/proxy1/res2')->status_is(200)->header_is('X-Mojo-App' => 'Two')->content_is('Two!'); -$t->get_ok('/proxy1/res3')->status_is(200)->header_is('X-Mojo-App' => 'Three')->header_is('X-Mojo-Method' => 'GET') - ->header_is('X-Mojo-More' => '')->header_is('X-Mojo-Body' => 0)->content_is('Three!'); -$t->get_ok('/proxy1/res4')->status_is(204)->header_is('X-Mojo-App' => 'Four')->content_is(''); -$t->get_ok('/proxy1/res5')->status_is(400)->content_like(qr/Error: /); -$t->get_ok('/proxy1/res6')->status_is(200)->content_is('Six!'); +subtest 'Various response variants' => sub { + $t->get_ok('/proxy1/res1')->status_is(200)->header_is('X-Mojo-App' => 'One')->content_is('One!'); + $t->get_ok('/proxy1/res2')->status_is(200)->header_is('X-Mojo-App' => 'Two')->content_is('Two!'); + $t->get_ok('/proxy1/res3')->status_is(200)->header_is('X-Mojo-App' => 'Three')->header_is('X-Mojo-Method' => 'GET') + ->header_is('X-Mojo-More' => '')->header_is('X-Mojo-Body' => 0)->content_is('Three!'); + $t->get_ok('/proxy1/res4')->status_is(204)->header_is('X-Mojo-App' => 'Four')->content_is(''); + $t->get_ok('/proxy1/res5')->status_is(400)->content_like(qr/Error: /); + $t->get_ok('/proxy1/res6')->status_is(200)->content_is('Six!'); +}; -# Custom request -$t->patch_ok('/proxy2/res3')->status_is(200)->header_is('X-Mojo-App' => 'Three')->header_is('X-Mojo-Method' => 'POST') - ->header_is('X-Mojo-More' => 'Less')->header_is('X-Mojo-Body' => 6)->content_is('Three!'); +subtest 'Custom request' => sub { + $t->patch_ok('/proxy2/res3')->status_is(200)->header_is('X-Mojo-App' => 'Three') + ->header_is('X-Mojo-Method' => 'POST')->header_is('X-Mojo-More' => 'Less')->header_is('X-Mojo-Body' => 6) + ->content_is('Three!'); +}; -# Response modification -$t->get_ok('/proxy3/GET/res1')->status_is(200)->header_exists_not('X-Mojo-App')->header_is('X-Mojo-Proxy1' => 'just') - ->header_is('X-Mojo-Proxy2' => 'works!')->content_is('One!'); -$t->get_ok('/proxy3/POST/res3')->status_is(200)->header_is('X-Mojo-Method' => 'POST')->header_exists_not('X-Mojo-App') - ->header_is('X-Mojo-Proxy1' => 'just')->header_is('X-Mojo-Proxy2' => 'works!')->content_is('Three!'); +subtest 'Response modification' => sub { + $t->get_ok('/proxy3/GET/res1')->status_is(200)->header_exists_not('X-Mojo-App')->header_is('X-Mojo-Proxy1' => 'just') + ->header_is('X-Mojo-Proxy2' => 'works!')->content_is('One!'); + $t->get_ok('/proxy3/POST/res3')->status_is(200)->header_is('X-Mojo-Method' => 'POST') + ->header_exists_not('X-Mojo-App')->header_is('X-Mojo-Proxy1' => 'just')->header_is('X-Mojo-Proxy2' => 'works!') + ->content_is('Three!'); +}; done_testing();