Improve proxy for redirects

Change-Id: I3d62dd698ced3d406fd4ff8377de1a01a0fde319
diff --git a/t/proxy.t b/t/proxy.t
index 7c54127..1dc1d08 100644
--- a/t/proxy.t
+++ b/t/proxy.t
@@ -118,5 +118,22 @@
   ->content_is('Proxy error: Inactivity timeout')
   ;
 
+$t->get_ok('/api/v1.0/redirect-target-a')
+  ->status_is(200)
+  ->content_is('Redirect Target!')
+  ;
+
+$t->get_ok('/api/v1.0/redirect')
+  ->status_is(308)
+  ->content_is('')
+  ;
+
+$t->ua->max_redirects(2);
+
+$t->get_ok('/api/v1.0/redirect')
+  ->status_is(200)
+  ->content_is('Redirect Target!')
+  ;
+
 done_testing;
 __END__
diff --git a/t/server/mock.pl b/t/server/mock.pl
index 2e14035..a1f0596 100644
--- a/t/server/mock.pl
+++ b/t/server/mock.pl
@@ -100,6 +100,20 @@
 };
 
 
+get '/v1.0/redirect-target-a' => sub {
+  shift->render(text => 'Redirect Target!');
+} => 'redirect-target';
+
+
+# Base page
+get '/v1.0/redirect' => sub {
+  my $c = shift;
+  $c->res->code(308);
+  $c->res->headers->location($c->url_for('redirect-target')->to_abs);
+  return $c->render(text => '');
+};
+
+
 # Search fixtures
 get '/v1.0/search' => sub {
   my $c = shift;