aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--perllib/FixMyStreet/App/Controller/Open311.pm2
-rw-r--r--t/app/controller/open311.t13
2 files changed, 14 insertions, 1 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Open311.pm b/perllib/FixMyStreet/App/Controller/Open311.pm
index 46d7801f6..fe1494b95 100644
--- a/perllib/FixMyStreet/App/Controller/Open311.pm
+++ b/perllib/FixMyStreet/App/Controller/Open311.pm
@@ -55,7 +55,7 @@ sub index : Path : Args(0) {
sub old_uri : Regex('^open311\.cgi') : Args(0) {
my ( $self, $c ) = @_;
( my $new = $c->req->path ) =~ s/open311.cgi/open311/;
- $c->res->redirect( "/$new", 301);
+ $c->res->redirect( $c->uri_for("/$new", $c->req->query_params), 301);
}
=head2 discovery
diff --git a/t/app/controller/open311.t b/t/app/controller/open311.t
new file mode 100644
index 000000000..9b0a6f8af
--- /dev/null
+++ b/t/app/controller/open311.t
@@ -0,0 +1,13 @@
+use strict;
+use warnings;
+
+use Test::More;
+
+use FixMyStreet::TestMech;
+my $mech = FixMyStreet::TestMech->new;
+
+# Check old .cgi links redirect correctly
+$mech->get_ok('/open311.cgi/v2/requests.rss?jurisdiction_id=fiksgatami.no&status=open&agency_responsible=1854');
+like $mech->uri, qr[/open311/v2/requests\.rss\?.{65}]; # Don't know order parameters will be in now
+
+done_testing();