Skip to content

Commit 3754803

Browse files
committed
test: do explicit check of CORS headers
License: MIT Signed-off-by: Jakub Sztandera <[email protected]>
1 parent 050985c commit 3754803

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

test/sharness/t0112-gateway-cors.sh

+6-4
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,12 @@ thash='QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn'
2828
test_expect_success "GET to Gateway succeeds" '
2929
curl -svX GET "http://127.0.0.1:$gwport/ipfs/$thash" 2>curl_output
3030
'
31+
32+
cat curl_output
3133
# GET Response from Gateway should contain CORS headers
3234
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" &&
3537
grep "Access-Control-Allow-Headers:" curl_output
3638
'
3739

@@ -41,8 +43,8 @@ test_expect_success "OPTIONS to Gateway succeeds" '
4143
'
4244
# OPTION Response from Gateway should contain CORS headers
4345
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" &&
4648
grep "Access-Control-Allow-Headers:" curl_output
4749
'
4850

0 commit comments

Comments
 (0)