Introduce CORS headers in proxy
Change-Id: Ibcc1033cbbfec268d9f2816cc6c4f1383563d8b1
diff --git a/t/proxy.t b/t/proxy.t
index 2b16623..518d7a4 100644
--- a/t/proxy.t
+++ b/t/proxy.t
@@ -58,6 +58,11 @@
$t->get_ok('/api/v1.0/')
->status_is(200)
+ ->header_is('X-Proxy', 'Kalamar')
+ ->header_is('X-Robots', 'noindex')
+ ->header_is('Connection', 'close')
+ ->header_is('Access-Control-Allow-Origin', '*')
+ ->header_is('Access-Control-Allow-Methods', 'GET, OPTIONS')
->content_is('Fake server available')
;
@@ -66,6 +71,8 @@
$t->get_ok('/api/v1.0/search?ql=cosmas3')
->status_is(400)
+ ->header_is('Access-Control-Allow-Origin', '*')
+ ->header_is('Access-Control-Allow-Methods', 'GET, OPTIONS')
->json_is('/errors/0/0','307')
->header_is('connection', 'close')
;
@@ -119,6 +126,8 @@
$t->get_ok('/api/v1.0/redirect-target-a')
->status_is(200)
+ ->header_is('Access-Control-Allow-Origin', '*')
+ ->header_is('Access-Control-Allow-Methods', 'GET, OPTIONS')
->content_is('Redirect Target!')
;
@@ -131,8 +140,19 @@
$t->get_ok('/api/v1.0/redirect')
->status_is(200)
+ ->header_is('Access-Control-Allow-Origin', '*')
->content_is('Redirect Target!')
;
+# Check CORS
+$t->options_ok('/api/v1.0/search?ql=cosmas3')
+ ->status_is(204)
+ ->content_is('')
+ ->header_is('Access-Control-Allow-Origin', '*')
+ ->header_is('Access-Control-Allow-Methods', 'GET, OPTIONS')
+ ->header_is('Access-Control-Max-Age', '86400')
+ ;
+
+
done_testing;
__END__