1
-#!/usr/bin/env bash
2
-
3
-test_description="Test HTTP Gateway DAG-JSON (application/vnd.ipld.dag-json) and DAG-CBOR (application/vnd.ipld.dag-cbor) Support"
4
-
5
-. lib/test-lib.sh
6
-
7
-test_init_ipfs
8
-test_launch_ipfs_daemon_without_network
9
-
10
-# Import test case
11
-# See the static fixtures in ./t0123-gateway-json-cbor/
12
-test_expect_success "Add the test directory" '
13
- ipfs dag import --pin-roots ../t0123-gateway-json-cbor/fixtures.car
14
-'
15
-DIR_CID=bafybeiafyvqlazbbbtjnn6how5d6h6l6rxbqc4qgpbmteaiskjrffmyy4a # ./rootDir
16
-FILE_JSON_CID=bafkreibrppizs3g7axs2jdlnjua6vgpmltv7k72l7v7sa6mmht6mne3qqe # ./rootDir/ą/ę/t.json
17
-FILE_CID=bafkreialihlqnf5uwo4byh4n3cmwlntwqzxxs2fg5vanqdi3d7tb2l5xkm # ./rootDir/ą/ę/file-źł.txt
18
-FILE_SIZE=34
19
-
20
-## Quick regression check for JSON stored on UnixFS:
21
-## it has nothing to do with DAG-JSON and JSON codecs,
22
-## but a lot of JSON data is stored on UnixFS and is requested with or without various hints
23
-## and we want to avoid surprises like https://github.com/protocol/bifrost-infra/issues/2290
24
-test_expect_success "GET UnixFS file with JSON bytes is returned with application/json Content-Type" '
25
- curl -sD headers "http://127.0.0.1:$GWAY_PORT/ipfs/$FILE_JSON_CID" > curl_output 2>&1 &&
26
- curl -sD headers_accept -H "Accept: application/json" "http://127.0.0.1:$GWAY_PORT/ipfs/$FILE_JSON_CID" > curl_output_accept 2>&1 &&
27
- ipfs cat $FILE_JSON_CID > ipfs_cat_output 2>&1 &&
28
- test_should_contain "Content-Type: application/json" headers &&
29
- test_should_contain "Content-Type: application/json" headers_accept &&
30
- test_cmp ipfs_cat_output curl_output &&
31
- test_cmp curl_output curl_output_accept
32
-'
33
-
34
-
35
-## Reading UnixFS (data encoded with dag-pb codec) as DAG-CBOR and DAG-JSON
36
-## (returns representation defined in https://ipld.io/specs/codecs/dag-pb/spec/#logical-format)
37
-
38
-test_dag_pb_conversion () {
39
- name=$1
40
- format=$2
41
- disposition=$3
42
-
43
- test_expect_success "GET UnixFS file as $name with format=dag-$format converts to the expected Content-Type" '
44
- curl -sD headers "http://127.0.0.1:$GWAY_PORT/ipfs/$FILE_CID?format=dag-$format" > curl_output 2>&1 &&
45
- ipfs dag get --output-codec dag-$format $FILE_CID > ipfs_dag_get_output 2>&1 &&
46
- test_cmp ipfs_dag_get_output curl_output &&
47
- test_should_contain "Content-Type: application/vnd.ipld.dag-$format" headers &&
48
- test_should_contain "Content-Disposition: ${disposition}\; filename=\"${FILE_CID}.${format}\"" headers &&
49
- test_should_not_contain "Content-Type: application/$format" headers
50
- '
51
-
52
- test_expect_success "GET UnixFS directory as $name with format=dag-$format converts to the expected Content-Type" '
53
- curl -sD headers "http://127.0.0.1:$GWAY_PORT/ipfs/$DIR_CID?format=dag-$format" > curl_output 2>&1 &&
54
- ipfs dag get --output-codec dag-$format $DIR_CID > ipfs_dag_get_output 2>&1 &&
55
- test_cmp ipfs_dag_get_output curl_output &&
56
- test_should_contain "Content-Type: application/vnd.ipld.dag-$format" headers &&
57
- test_should_contain "Content-Disposition: ${disposition}\; filename=\"${DIR_CID}.${format}\"" headers &&
58
- test_should_not_contain "Content-Type: application/$format" headers
59
- '
60
-
61
- test_expect_success "GET UnixFS as $name with 'Accept: application/vnd.ipld.dag-$format' converts to the expected Content-Type" '
62
- curl -sD - -H "Accept: application/vnd.ipld.dag-$format" "http://127.0.0.1:$GWAY_PORT/ipfs/$FILE_CID" > curl_output 2>&1 &&
63
- test_should_contain "Content-Disposition: ${disposition}\; filename=\"${FILE_CID}.${format}\"" curl_output &&
64
- test_should_contain "Content-Type: application/vnd.ipld.dag-$format" curl_output &&
65
- test_should_not_contain "Content-Type: application/$format" curl_output
66
- '
67
-
68
- test_expect_success "GET UnixFS as $name with 'Accept: foo, application/vnd.ipld.dag-$format,bar' converts to the expected Content-Type" '
69
- curl -sD - -H "Accept: foo, application/vnd.ipld.dag-$format,text/plain" "http://127.0.0.1:$GWAY_PORT/ipfs/$FILE_CID" > curl_output 2>&1 &&
70
- test_should_contain "Content-Type: application/vnd.ipld.dag-$format" curl_output
71
- '
72
-
73
- test_expect_success "GET UnixFS with format=$format (not dag-$format) is no-op (no conversion)" '
74
- curl -sD headers "http://127.0.0.1:$GWAY_PORT/ipfs/$FILE_CID?format=$format" > curl_output 2>&1 &&
75
- ipfs cat $FILE_CID > cat_output &&
76
- test_cmp cat_output curl_output &&
77
- test_should_contain "Content-Type: text/plain" headers &&
78
- test_should_not_contain "Content-Type: application/$format" headers &&
79
- test_should_not_contain "Content-Type: application/vnd.ipld.dag-$format" headers
80
- '
81
-
82
- test_expect_success "GET UnixFS with 'Accept: application/$format' (not dag-$format) is no-op (no conversion)" '
83
- curl -sD headers -H "Accept: application/$format" "http://127.0.0.1:$GWAY_PORT/ipfs/$FILE_CID" > curl_output 2>&1 &&
84
- ipfs cat $FILE_CID > cat_output &&
85
- test_cmp cat_output curl_output &&
86
- test_should_contain "Content-Type: text/plain" headers &&
87
- test_should_not_contain "Content-Type: application/$format" headers &&
88
- test_should_not_contain "Content-Type: application/vnd.ipld.dag-$format" headers
89
- '
90
-}
91
-
92
-test_dag_pb_conversion "DAG-JSON" "json" "inline"
93
-test_dag_pb_conversion "DAG-CBOR" "cbor" "attachment"
94
-
95
-
96
-# Requesting CID with plain json (0x0200) and cbor (0x51) codecs
97
-# (note these are not UnixFS, not DAG-* variants, just raw block identified by a CID with a special codec)
98
-test_plain_codec () {
99
- name=$1
100
- format=$2
101
- disposition=$3
102
-
103
- # no explicit format, just codec in CID
104
- test_expect_success "GET $name without Accept or format= has expected $format Content-Type and body as-is" '
105
- CID=$(echo "{ \"test\": \"plain json\" }" | ipfs dag put --input-codec json --store-codec $format) &&
106
- curl -sD headers "http://127.0.0.1:$GWAY_PORT/ipfs/$CID" > curl_output 2>&1 &&
107
- ipfs block get $CID > ipfs_block_output 2>&1 &&
108
- test_cmp ipfs_block_output curl_output &&
109
- test_should_contain "Content-Disposition: ${disposition}\; filename=\"${CID}.${format}\"" headers &&
110
- test_should_contain "Content-Type: application/$format" headers
111
- '
112
-
113
- # explicit format still gives correct output, just codec in CID
114
- test_expect_success "GET $name with ?format= has expected $format Content-Type and body as-is" '
115
- CID=$(echo "{ \"test\": \"plain json\" }" | ipfs dag put --input-codec json --store-codec $format) &&
116
- curl -sD headers "http://127.0.0.1:$GWAY_PORT/ipfs/$CID?format=$format" > curl_output 2>&1 &&
117
- ipfs block get $CID > ipfs_block_output 2>&1 &&
118
- test_cmp ipfs_block_output curl_output &&
119
- test_should_contain "Content-Disposition: ${disposition}\; filename=\"${CID}.${format}\"" headers &&
120
- test_should_contain "Content-Type: application/$format" headers
121
- '
122
-
123
- # explicit format still gives correct output, just codec in CID
124
- test_expect_success "GET $name with Accept has expected $format Content-Type and body as-is" '
125
- CID=$(echo "{ \"test\": \"plain json\" }" | ipfs dag put --input-codec json --store-codec $format) &&
126
- curl -sD headers -H "Accept: application/$format" "http://127.0.0.1:$GWAY_PORT/ipfs/$CID" > curl_output 2>&1 &&
127
- ipfs block get $CID > ipfs_block_output 2>&1 &&
128
- test_cmp ipfs_block_output curl_output &&
129
- test_should_contain "Content-Disposition: ${disposition}\; filename=\"${CID}.${format}\"" headers &&
130
- test_should_contain "Content-Type: application/$format" headers
131
- '
132
-
133
- # explicit dag-* format passed, attempt to parse as dag* variant
134
- ## Note: this works only for simple JSON that can be upgraded to DAG-JSON.
135
- test_expect_success "GET $name with format=dag-$format interprets $format as dag-* variant and produces expected Content-Type and body" '
136
- CID=$(echo "{ \"test\": \"plain-json-that-can-also-be-dag-json\" }" | ipfs dag put --input-codec json --store-codec $format) &&
137
- curl -sD headers "http://127.0.0.1:$GWAY_PORT/ipfs/$CID?format=dag-$format" > curl_output_param 2>&1 &&
138
- ipfs dag get --output-codec dag-$format $CID > ipfs_dag_get_output 2>&1 &&
139
- test_cmp ipfs_dag_get_output curl_output_param &&
140
- test_should_contain "Content-Disposition: ${disposition}\; filename=\"${CID}.${format}\"" headers &&
141
- test_should_contain "Content-Type: application/vnd.ipld.dag-$format" headers &&
142
- curl -s -H "Accept: application/vnd.ipld.dag-$format" "http://127.0.0.1:$GWAY_PORT/ipfs/$CID" > curl_output_accept 2>&1 &&
143
- test_cmp curl_output_param curl_output_accept
144
- '
145
-
146
-}
147
-
148
-test_plain_codec "plain JSON codec" "json" "inline"
149
-test_plain_codec "plain CBOR codec" "cbor" "attachment"
150
-
151
-## Pathing, traversal over DAG-JSON and DAG-CBOR
152
-
153
-DAG_CBOR_TRAVERSAL_CID="bafyreibs4utpgbn7uqegmd2goqz4bkyflre2ek2iwv743fhvylwi4zeeim"
154
-DAG_JSON_TRAVERSAL_CID="baguqeeram5ujjqrwheyaty3w5gdsmoz6vittchvhk723jjqxk7hakxkd47xq"
155
-DAG_PB_CID="bafybeiegxwlgmoh2cny7qlolykdf7aq7g6dlommarldrbm7c4hbckhfcke"
156
-
157
-test_expect_success "Add CARs for path traversal and DAG-PB representation tests" '
158
- ipfs dag import --pin-roots ../t0123-gateway-json-cbor/dag-cbor-traversal.car > import_output &&
159
- test_should_contain $DAG_CBOR_TRAVERSAL_CID import_output &&
160
- ipfs dag import --pin-roots ../t0123-gateway-json-cbor/dag-json-traversal.car > import_output &&
161
- test_should_contain $DAG_JSON_TRAVERSAL_CID import_output &&
162
- ipfs dag import --pin-roots ../t0123-gateway-json-cbor/dag-pb.car > import_output &&
163
- test_should_contain $DAG_PB_CID import_output
164
-'
165
-
166
-IPNS_ID_DAG_JSON=k51qzi5uqu5dhjghbwdvbo6mi40htrq6e2z4pwgp15pgv3ho1azvidttzh8yy2
167
-IPNS_ID_DAG_CBOR=k51qzi5uqu5dghjous0agrwavl8vzl64xckoqzwqeqwudfr74kfd11zcyk3b7l
168
-
169
-test_expect_success "Add ipns records for path traversal and DAG-PB representation tests" '
170
- ipfs routing put --allow-offline /ipns/${IPNS_ID_DAG_JSON} ../t0123-gateway-json-cbor/${IPNS_ID_DAG_JSON}.ipns-record &&
171
- ipfs routing put --allow-offline /ipns/${IPNS_ID_DAG_CBOR} ../t0123-gateway-json-cbor/${IPNS_ID_DAG_CBOR}.ipns-record
172
-'
173
-
174
-test_expect_success "GET DAG-JSON traversal returns 501 if there is path remainder" '
175
- curl -sD - "http://127.0.0.1:$GWAY_PORT/ipfs/$DAG_JSON_TRAVERSAL_CID/foo?format=dag-json" > curl_output 2>&1 &&
176
- test_should_contain "501 Not Implemented" curl_output &&
177
- test_should_contain "reading IPLD Kinds other than Links (CBOR Tag 42) is not implemented" curl_output
178
-'
179
-
180
-test_expect_success "GET DAG-JSON traverses multiple links" '
181
- curl -s "http://127.0.0.1:$GWAY_PORT/ipfs/$DAG_JSON_TRAVERSAL_CID/foo/link/bar?format=dag-json" > curl_output 2>&1 &&
182
- jq --sort-keys . curl_output > actual &&
183
- echo "{ \"hello\": \"this is not a link\" }" | jq --sort-keys . > expected &&
184
- test_cmp expected actual
185
-'
186
-
187
-test_expect_success "GET DAG-CBOR traversal returns 501 if there is path remainder" '
188
- curl -sD - "http://127.0.0.1:$GWAY_PORT/ipfs/$DAG_CBOR_TRAVERSAL_CID/foo?format=dag-cbor" > curl_output 2>&1 &&
189
- test_should_contain "501 Not Implemented" curl_output &&
190
- test_should_contain "reading IPLD Kinds other than Links (CBOR Tag 42) is not implemented" curl_output
191
-'
192
-
193
-test_expect_success "GET DAG-CBOR traverses multiple links" '
194
- curl -s "http://127.0.0.1:$GWAY_PORT/ipfs/$DAG_CBOR_TRAVERSAL_CID/foo/link/bar?format=dag-json" > curl_output 2>&1 &&
195
- jq --sort-keys . curl_output > actual &&
196
- echo "{ \"hello\": \"this is not a link\" }" | jq --sort-keys . > expected &&
197
- test_cmp expected actual
198
-'
199
-
200
-## NATIVE TESTS for DAG-JSON (0x0129) and DAG-CBOR (0x71):
201
-## DAG- regression tests for core behaviors when native DAG-(CBOR|JSON) is requested
202
-
203
-test_native_dag () {
204
- name=$1
205
- format=$2
206
- disposition=$3
207
- CID=$4
208
- IPNS_ID=$5
209
-
210
- # GET without explicit format and Accept: text/html returns raw block
211
-
212
- test_expect_success "GET $name from /ipfs without explicit format returns the same payload as the raw block" '
213
- ipfs block get "/ipfs/$CID" > expected &&
214
- curl -sX GET "http://127.0.0.1:$GWAY_PORT/ipfs/$CID" -o curl_output &&
215
- test_cmp expected curl_output
216
- '
217
-
218
- # GET dag-cbor block via Accept and ?format and ensure both are the same as `ipfs block get` output
219
-
220
- test_expect_success "GET $name from /ipfs with format=dag-$format returns the same payload as the raw block" '
221
- ipfs block get "/ipfs/$CID" > expected &&
222
- curl -sX GET "http://127.0.0.1:$GWAY_PORT/ipfs/$CID?format=dag-$format" -o curl_ipfs_dag_param_output &&
223
- test_cmp expected curl_ipfs_dag_param_output
224
- '
225
-
226
- test_expect_success "GET $name from /ipfs for application/$format returns the same payload as format=dag-$format" '
227
- curl -sX GET "http://127.0.0.1:$GWAY_PORT/ipfs/$CID?format=dag-$format" -o expected &&
228
- curl -sX GET "http://127.0.0.1:$GWAY_PORT/ipfs/$CID?format=$format" -o plain_output &&
229
- test_cmp expected plain_output
230
- '
231
-
232
- test_expect_success "GET $name from /ipfs with application/vnd.ipld.dag-$format returns the same payload as the raw block" '
233
- ipfs block get "/ipfs/$CID" > expected_block &&
234
- curl -sX GET -H "Accept: application/vnd.ipld.dag-$format" "http://127.0.0.1:$GWAY_PORT/ipfs/$CID" -o curl_ipfs_dag_block_accept_output &&
235
- test_cmp expected_block curl_ipfs_dag_block_accept_output
236
- '
237
-
238
- # Make sure DAG-* can be requested as plain JSON or CBOR and response has plain Content-Type for interop purposes
239
-
240
- test_expect_success "GET $name with format=$format returns same payload as format=dag-$format but with plain Content-Type" '
241
- curl -s "http://127.0.0.1:$GWAY_PORT/ipfs/$CID?format=dag-$format" -o expected &&
242
- curl -sD plain_headers "http://127.0.0.1:$GWAY_PORT/ipfs/$CID?format=$format" -o plain_output &&
243
- test_should_contain "Content-Type: application/$format" plain_headers &&
244
- test_cmp expected plain_output
245
- '
246
-
247
- test_expect_success "GET $name with Accept: application/$format returns same payload as application/vnd.ipld.dag-$format but with plain Content-Type" '
248
- curl -s -H "Accept: application/vnd.ipld.dag-$format" "http://127.0.0.1:$GWAY_PORT/ipfs/$CID" > expected &&
249
- curl -sD plain_headers -H "Accept: application/$format" "http://127.0.0.1:$GWAY_PORT/ipfs/$CID" > plain_output &&
250
- test_should_contain "Content-Type: application/$format" plain_headers &&
251
- test_cmp expected plain_output
252
- '
253
-
254
-
255
- # Make sure expected HTTP headers are returned with the dag- block
256
-
257
- test_expect_success "GET response for application/vnd.ipld.dag-$format has expected Content-Type" '
258
- curl -svX GET -H "Accept: application/vnd.ipld.dag-$format" "http://127.0.0.1:$GWAY_PORT/ipfs/$CID" >/dev/null 2>curl_output &&
259
- test_should_contain "< Content-Type: application/vnd.ipld.dag-$format" curl_output
260
- '
261
-
262
- test_expect_success "GET response for application/vnd.ipld.dag-$format includes Content-Length" '
263
- BYTES=$(ipfs block get $CID | wc --bytes)
264
- test_should_contain "< Content-Length: $BYTES" curl_output
265
- '
266
-
267
- test_expect_success "GET response for application/vnd.ipld.dag-$format includes Content-Disposition" '
268
- test_should_contain "< Content-Disposition: ${disposition}\; filename=\"${CID}.${format}\"" curl_output
269
- '
270
-
271
- test_expect_success "GET response for application/vnd.ipld.dag-$format includes nosniff hint" '
272
- test_should_contain "< X-Content-Type-Options: nosniff" curl_output
273
- '
274
-
275
- test_expect_success "GET for application/vnd.ipld.dag-$format with query filename includes Content-Disposition with custom filename" '
276
- curl -svX GET -H "Accept: application/vnd.ipld.dag-$format" "http://127.0.0.1:$GWAY_PORT/ipfs/$CID?filename=foobar.$format" >/dev/null 2>curl_output_filename &&
277
- test_should_contain "< Content-Disposition: ${disposition}\; filename=\"foobar.$format\"" curl_output_filename
278
- '
279
-
280
- test_expect_success "GET for application/vnd.ipld.dag-$format with ?download=true forces Content-Disposition: attachment" '
281
- curl -svX GET -H "Accept: application/vnd.ipld.dag-$format" "http://127.0.0.1:$GWAY_PORT/ipfs/$CID?filename=foobar.$format&download=true" >/dev/null 2>curl_output_filename &&
282
- test_should_contain "< Content-Disposition: attachment" curl_output_filename
283
- '
284
-
285
- # Cache control HTTP headers
286
- # (basic checks, detailed behavior is tested in t0116-gateway-cache.sh)
287
-
288
- test_expect_success "GET response for application/vnd.ipld.dag-$format includes Etag" '
289
- test_should_contain "< Etag: \"${CID}.dag-$format\"" curl_output
290
- '
291
-
292
- test_expect_success "GET response for application/vnd.ipld.dag-$format includes X-Ipfs-Path and X-Ipfs-Roots" '
293
- test_should_contain "< X-Ipfs-Path" curl_output &&
294
- test_should_contain "< X-Ipfs-Roots" curl_output
295
- '
296
-
297
- test_expect_success "GET response for application/vnd.ipld.dag-$format includes Cache-Control" '
298
- test_should_contain "< Cache-Control: public, max-age=29030400, immutable" curl_output
299
- '
300
-
301
- # HTTP HEAD behavior
302
- test_expect_success "HEAD $name with no explicit format returns HTTP 200" '
303
- curl -I "http://127.0.0.1:$GWAY_PORT/ipfs/$CID" -o output &&
304
- test_should_contain "HTTP/1.1 200 OK" output &&
305
- test_should_contain "Content-Type: application/vnd.ipld.dag-$format" output &&
306
- test_should_contain "Content-Length: " output
307
- '
308
- test_expect_success "HEAD $name with an explicit DAG-JSON format returns HTTP 200" '
309
- curl -I "http://127.0.0.1:$GWAY_PORT/ipfs/$CID?format=dag-json" -o output &&
310
- test_should_contain "HTTP/1.1 200 OK" output &&
311
- test_should_contain "Etag: \"$CID.dag-json\"" output &&
312
- test_should_contain "Content-Type: application/vnd.ipld.dag-json" output &&
313
- test_should_contain "Content-Length: " output
314
- '
315
- test_expect_success "HEAD $name with only-if-cached for missing block returns HTTP 412 Precondition Failed" '
316
- MISSING_CID=$(echo "{\"t\": \"$(date +%s)\"}" | ipfs dag put --store-codec=dag-${format}) &&
317
- ipfs block rm -f -q $MISSING_CID &&
318
- curl -I -H "Cache-Control: only-if-cached" "http://127.0.0.1:$GWAY_PORT/ipfs/$MISSING_CID" -o output &&
319
- test_should_contain "HTTP/1.1 412 Precondition Failed" output
320
- '
321
-
322
- # IPNS behavior (should be same as immutable /ipfs, but with different caching headers)
323
- # To keep tests small we only confirm payload is the same, and then only test delta around caching headers.
324
-
325
- test_expect_success "GET $name from /ipns without explicit format returns the same payload as /ipfs" '
326
- curl -sX GET "http://127.0.0.1:$GWAY_PORT/ipfs/$CID" -o ipfs_output &&
327
- curl -sX GET "http://127.0.0.1:$GWAY_PORT/ipns/$IPNS_ID" -o ipns_output &&
328
- test_cmp ipfs_output ipns_output
329
- '
330
-
331
- test_expect_success "GET $name from /ipns without explicit format returns the same payload as /ipfs" '
332
- curl -sX GET "http://127.0.0.1:$GWAY_PORT/ipfs/$CID?format=dag-$format" -o ipfs_output &&
333
- curl -sX GET "http://127.0.0.1:$GWAY_PORT/ipns/$IPNS_ID?format=dag-$format" -o ipns_output &&
334
- test_cmp ipfs_output ipns_output
335
- '
336
-
337
- test_expect_success "GET $name from /ipns with explicit application/vnd.ipld.dag-$format has expected headers" '
338
- curl -svX GET -H "Accept: application/vnd.ipld.dag-$format" "http://127.0.0.1:$GWAY_PORT/ipns/$IPNS_ID" >/dev/null 2>curl_output &&
339
- test_should_not_contain "Cache-Control" curl_output &&
340
- test_should_contain "< Content-Type: application/vnd.ipld.dag-$format" curl_output &&
341
- test_should_contain "< Etag: \"${CID}.dag-$format\"" curl_output &&
342
- test_should_contain "< X-Ipfs-Path" curl_output &&
343
- test_should_contain "< X-Ipfs-Roots" curl_output
344
- '
345
-
346
-
347
- # When Accept header includes text/html and no explicit format is requested for DAG-(CBOR|JSON)
348
- # The gateway returns generated HTML index (see dag-index-html) for web browsers (similar to dir-index-html returned for unixfs dirs)
349
- # As this is generated, we don't return immutable Cache-Control, even on /ipfs (same as for dir-index-html)
350
-
351
- test_expect_success "GET $name on /ipfs with Accept: text/html returns HTML (dag-index-html)" '
352
- curl -sD - -H "Accept: text/html" "http://127.0.0.1:$GWAY_PORT/ipfs/$CID/" > curl_output 2>&1 &&
353
- test_should_not_contain "Content-Disposition" curl_output &&
354
- test_should_not_contain "Cache-Control" curl_output &&
355
- test_should_contain "Etag: \"DagIndex-" curl_output &&
356
- test_should_contain "Content-Type: text/html" curl_output &&
357
- test_should_contain "</html>" curl_output
358
- '
359
-
360
- test_expect_success "GET $name on /ipns with Accept: text/html returns HTML (dag-index-html)" '
361
- curl -sD - -H "Accept: text/html" "http://127.0.0.1:$GWAY_PORT/ipns/$IPNS_ID/" > curl_output 2>&1 &&
362
- test_should_not_contain "Content-Disposition" curl_output &&
363
- test_should_not_contain "Cache-Control" curl_output &&
364
- test_should_contain "Etag: \"DagIndex-" curl_output &&
365
- test_should_contain "Content-Type: text/html" curl_output &&
366
- test_should_contain "</html>" curl_output
367
- '
368
-
369
-
370
-}
371
-
372
-test_native_dag "DAG-JSON" "json" "inline" "$DAG_JSON_TRAVERSAL_CID" ${IPNS_ID_DAG_JSON}
373
-test_native_dag "DAG-CBOR" "cbor" "attachment" "$DAG_CBOR_TRAVERSAL_CID" ${IPNS_ID_DAG_CBOR}
374
-
375
-test_kill_ipfs_daemon
376
-
377
-test_done
378
-
379
-# vim: set ts=2 sw=2 et: