From 8b7a4a79d96b3ea6a25b60ece8adf6cae4b39908 Mon Sep 17 00:00:00 2001 From: Jakub Sztandera Date: Mon, 29 Aug 2016 20:54:35 +0200 Subject: [PATCH] test: do explicit check of CORS headers License: MIT Signed-off-by: Jakub Sztandera --- test/sharness/t0112-gateway-cors.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/test/sharness/t0112-gateway-cors.sh b/test/sharness/t0112-gateway-cors.sh index dbb51021ae8d..b7826518fd8c 100755 --- a/test/sharness/t0112-gateway-cors.sh +++ b/test/sharness/t0112-gateway-cors.sh @@ -28,10 +28,11 @@ thash='QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn' test_expect_success "GET to Gateway succeeds" ' curl -svX GET "http://127.0.0.1:$gwport/ipfs/$thash" 2>curl_output ' + # GET Response from Gateway should contain CORS headers test_expect_success "GET response for Gateway resource looks good" ' - grep "Access-Control-Allow-Origin:" curl_output && - grep "Access-Control-Allow-Methods:" curl_output && + grep "Access-Control-Allow-Origin:" curl_output | grep "\*" && + grep "Access-Control-Allow-Methods:" curl_output | grep "\"GET\"" && grep "Access-Control-Allow-Headers:" curl_output ' @@ -41,8 +42,8 @@ test_expect_success "OPTIONS to Gateway succeeds" ' ' # OPTION Response from Gateway should contain CORS headers test_expect_success "OPTIONS response for Gateway resource looks good" ' - grep "Access-Control-Allow-Origin:" curl_output && - grep "Access-Control-Allow-Methods:" curl_output && + grep "Access-Control-Allow-Origin:" curl_output | grep "\*" && + grep "Access-Control-Allow-Methods:" curl_output | grep "\"GET\"" && grep "Access-Control-Allow-Headers:" curl_output '