Emit 'after_render' hook in proxy to make requests accessible for post processing
Change-Id: Ica93aad2b46d34583751883159b58f40a34c0517
diff --git a/t/proxy.t b/t/proxy.t
index f30e049..2e2f922 100644
--- a/t/proxy.t
+++ b/t/proxy.t
@@ -33,22 +33,44 @@
# Globally set server
$t->app->ua->server->app($t->app);
+my $rendered = 0;
+$t->app->hook(
+ after_render => sub {
+ $rendered++;
+ }
+);
+
+$t->get_ok('/doc')
+ ->status_is(200)
+ ->text_like('title', qr!KorAP!)
+ ;
+
+is($rendered, 1);
+
$t->get_ok('/realapi/v1.0')
->status_is(200)
->content_is('Fake server available')
;
+is($rendered, 1);
+
$t->get_ok('/api/v1.0/')
->status_is(200)
->content_is('Fake server available')
;
+# Proxy renders
+is($rendered, 2);
+
$t->get_ok('/api/v1.0/search?ql=cosmas3')
->status_is(400)
->json_is('/errors/0/0','307')
->header_is('connection', 'close')
;
+# Proxy renders
+is($rendered, 3);
+
$t->post_ok('/api/v1.0/oauth2/token' => {} => form => {
username => 'test',
password => 'pass'