Skip to content

Commit 8a9c2b3

Browse files
committed
test: add accept: text/html tests
1 parent f5d474b commit 8a9c2b3

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

test/sharness/t0123-gateway-json-cbor.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,11 @@ test_expect_success "Add CARs for path traversal and DAG-PB representation tests
142142
test_should_contain $DAG_PB_CID import_output
143143
'
144144

145+
test_expect_success "GET DAG-JSON with Accept: text/html returns HTML" '
146+
curl -sD - -H "Accept: text/html" "http://127.0.0.1:$GWAY_PORT/ipfs/$DAG_JSON_TRAVERSAL_CID" > curl_output 2>&1 &&
147+
test_should_contain "Content-Type: text/html" curl_output
148+
'
149+
145150
test_expect_success "GET DAG-JSON traversal returns 400 if there is path remainder" '
146151
curl --head "http://127.0.0.1:$GWAY_PORT/ipfs/$DAG_JSON_TRAVERSAL_CID/foo?format=dag-json" > curl_output 2>&1 &&
147152
test_should_contain "400 Bad Request" curl_output
@@ -154,6 +159,11 @@ test_expect_success "GET DAG-JSON traverses multiple links" '
154159
test_cmp expected actual
155160
'
156161

162+
test_expect_success "GET DAG-CBOR with Accept: text/html returns HTML" '
163+
curl -sD - -H "Accept: text/html" "http://127.0.0.1:$GWAY_PORT/ipfs/$DAG_CBOR_TRAVERSAL_CID" > curl_output 2>&1 &&
164+
test_should_contain "Content-Type: text/html" curl_output
165+
'
166+
157167
test_expect_success "GET DAG-CBOR traversal returns 400 if there is path remainder" '
158168
curl --head "http://127.0.0.1:$GWAY_PORT/ipfs/$DAG_CBOR_TRAVERSAL_CID/foo?format=dag-cbor" > curl_output 2>&1 &&
159169
test_should_contain "400 Bad Request" curl_output

0 commit comments

Comments
 (0)