Skip to content

Commit

Permalink
test: do explicit check of CORS headers
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
  • Loading branch information
Kubuxu committed Aug 29, 2016
1 parent 050985c commit 8b7a4a7
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions test/sharness/t0112-gateway-cors.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
'

Expand All @@ -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
'

Expand Down

0 comments on commit 8b7a4a7

Please sign in to comment.