diff --git a/test/sharness/t0123-gateway-json-cbor.sh b/test/sharness/t0123-gateway-json-cbor.sh index a0fa4201fa92..f94d977f3c4d 100755 --- a/test/sharness/t0123-gateway-json-cbor.sh +++ b/test/sharness/t0123-gateway-json-cbor.sh @@ -23,53 +23,54 @@ test_expect_success "Add the test directory" ' ' test_codec () { - format=$1 + name=$1 + format=$2 - test_expect_success "GET $format with format=dag-$format has expected Content-Type" ' + test_expect_success "GET $name with format=dag-$format has expected Content-Type" ' curl -sD - "http://127.0.0.1:$GWAY_PORT/ipfs/$FILE_CID?format=dag-$format" > curl_output 2>&1 && test_should_contain "Content-Type: application/vnd.ipld.dag-$format" curl_output && test_should_not_contain "Content-Type: application/$format" curl_output ' - test_expect_success "GET $format with 'Accept: application/vnd.ipld.dag-$format' has expected Content-Type" ' + test_expect_success "GET $name with 'Accept: application/vnd.ipld.dag-$format' has expected Content-Type" ' curl -sD - -H "Accept: application/vnd.ipld.dag-$format" "http://127.0.0.1:$GWAY_PORT/ipfs/$FILE_CID" > curl_output 2>&1 && test_should_contain "Content-Type: application/vnd.ipld.dag-$format" curl_output && test_should_not_contain "Content-Type: application/$format" curl_output ' - test_expect_success "GET $format with format=$format has expected Content-Type" ' + test_expect_success "GET $name with format=$format has expected Content-Type" ' curl -sD - "http://127.0.0.1:$GWAY_PORT/ipfs/$FILE_CID?format=$format" > curl_output 2>&1 && test_should_contain "Content-Type: application/$format" curl_output && test_should_not_contain "Content-Type: application/vnd.ipld.dag-$format" curl_output ' - test_expect_success "GET $format with 'Accept: application/$format' has expected Content-Type" ' + test_expect_success "GET $name with 'Accept: application/$format' has expected Content-Type" ' curl -sD - -H "Accept: application/$format" "http://127.0.0.1:$GWAY_PORT/ipfs/$FILE_CID" > curl_output 2>&1 && test_should_contain "Content-Type: application/$format" curl_output && test_should_not_contain "Content-Type: application/vnd.ipld.dag-$format" curl_output ' - test_expect_success "GET $format has expected output for file" ' + test_expect_success "GET $name has expected output for file" ' curl -s "http://127.0.0.1:$GWAY_PORT/ipfs/$FILE_CID?format=dag-$format" > curl_output 2>&1 && ipfs dag get --output-codec dag-$format $FILE_CID > ipfs_dag_get_output 2>&1 && test_cmp ipfs_dag_get_output curl_output ' - test_expect_success "GET $format has expected output for directory" ' + test_expect_success "GET $name has expected output for directory" ' curl -s "http://127.0.0.1:$GWAY_PORT/ipfs/$DIR_CID?format=dag-$format" > curl_output 2>&1 && ipfs dag get --output-codec dag-$format $DIR_CID > ipfs_dag_get_output 2>&1 && test_cmp ipfs_dag_get_output curl_output ' - test_expect_success "GET $format with format=dag-$format and format=$format produce same output" ' + test_expect_success "GET $name with format=dag-$format and format=$format produce same output" ' curl -s "http://127.0.0.1:$GWAY_PORT/ipfs/$DIR_CID?format=dag-$format" > curl_output_1 2>&1 && curl -s "http://127.0.0.1:$GWAY_PORT/ipfs/$DIR_CID?format=$format" > curl_output_2 2>&1 && test_cmp curl_output_1 curl_output_2 ' } -test_codec "json" -test_codec "cbor" +test_codec "DAG-JSON" "json" +test_codec "DAG-CBOR" "cbor" test_kill_ipfs_daemon