From 0b1c6867ee10d9edcbd75c359cb23c75b732682e Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 27 May 2016 08:57:42 +0000 Subject: config: fix NewsWWW fallback for newsgroups in HTTP URLs Oops, added a test to prevent regressions while we're at it. --- t/plack.t | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 't') diff --git a/t/plack.t b/t/plack.t index c8dd7bfe..04680b2a 100644 --- a/t/plack.t +++ b/t/plack.t @@ -30,6 +30,8 @@ foreach my $mod (@mods) { use_ok $mod; } my %cfg = ( "$cfgpfx.address" => $addr, "$cfgpfx.mainrepo" => $maindir, + "$cfgpfx.url" => 'http://example.com/test/', + "$cfgpfx.newsgroup" => 'inbox.test', ); while (my ($k,$v) = each %cfg) { is(0, system(qw(git config --file), $pi_config, $k, $v), @@ -60,6 +62,19 @@ EOF require $psgi; }; + # redirect with newsgroup + test_psgi($app, sub { + my ($cb) = @_; + my $from = 'http://example.com/inbox.test'; + my $to = 'http://example.com/test/'; + my $res = $cb->(GET($from)); + is($res->code, 301, 'is permanent redirect'); + is($to, $res->header('Location'), 'redirect location matches'); + $from .= '/'; + is($res->code, 301, 'is permanent redirect'); + is($to, $res->header('Location'), 'redirect location matches'); + }); + # redirect with trailing / test_psgi($app, sub { my ($cb) = @_; -- cgit v1.2.3-24-ge0c7