test: do explicit check of CORS headers
License: MIT Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
Jakub Sztandera committed
Aug 29, 2016 at 20:54 UTC
3754803a6767bbcffb5ffc7068949558542ddec9
1 file changed
+6
-4
test/sharness/t0112-gateway-cors.sh
+6
-4
@@ -28,10 +28,12 @@ thash='QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn'
28
test_expect_success "GET to Gateway succeeds" '
29
curl -svX GET "http://127.0.0.1:$gwport/ipfs/$thash" 2>curl_output
30
'
31
+
32
+cat curl_output
33
# GET Response from Gateway should contain CORS headers
34
test_expect_success "GET response for Gateway resource looks good" '
33
- grep "Access-Control-Allow-Origin:" curl_output &&
34
- grep "Access-Control-Allow-Methods:" curl_output &&
35
+ grep "Access-Control-Allow-Origin:" curl_output | grep "\*" &&
36
+ grep "Access-Control-Allow-Methods:" curl_output | grep " GET\b" &&
37
grep "Access-Control-Allow-Headers:" curl_output
38
'
39
@@ -41,8 +43,8 @@ test_expect_success "OPTIONS to Gateway succeeds" '
43
'
44
# OPTION Response from Gateway should contain CORS headers
45
test_expect_success "OPTIONS response for Gateway resource looks good" '
44
- grep "Access-Control-Allow-Origin:" curl_output &&
45
- grep "Access-Control-Allow-Methods:" curl_output &&
46
+ grep "Access-Control-Allow-Origin:" curl_output | grep "\*" &&
47
+ grep "Access-Control-Allow-Methods:" curl_output | grep " GET\b" &&
48
grep "Access-Control-Allow-Headers:" curl_output
49
'
50