hypercore-fetch 9.3.0 → 9.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/index.js +1 -1
  2. package/package.json +1 -1
  3. package/test.js +20 -0
package/index.js CHANGED
@@ -604,7 +604,7 @@ export default async function makeHyperFetch ({
604
604
  if (!noResolve) {
605
605
  for (const indexFile of INDEX_FILES) {
606
606
  if (entries.includes(indexFile)) {
607
- return serveFile(drive, posix.join(pathname, 'indexFile'), isRanged)
607
+ return serveFile(drive, posix.join(pathname, indexFile), isRanged)
608
608
  }
609
609
  }
610
610
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hypercore-fetch",
3
- "version": "9.3.0",
3
+ "version": "9.3.1",
4
4
  "description": "Implementation of Fetch that uses the Dat SDK for loading p2p content",
5
5
  "type": "module",
6
6
  "main": "index.js",
package/test.js CHANGED
@@ -333,6 +333,26 @@ test('Ignore index.html with noResolve', async (t) => {
333
333
  const entries = await listDirRequest.json()
334
334
  t.deepEqual(entries, ['index.html'], 'able to list index.html')
335
335
  })
336
+ test('Render index.gmi', async (t) => {
337
+ const created = await nextURL(t)
338
+ const uploadLocation = new URL('./index.gmi', created)
339
+
340
+ const uploadResponse = await fetch(uploadLocation, {
341
+ method: 'put',
342
+ body: SAMPLE_CONTENT
343
+ })
344
+ await checkResponse(uploadResponse, t)
345
+
346
+ const uploadedContentResponse = await fetch(created)
347
+
348
+ await checkResponse(uploadedContentResponse, t)
349
+
350
+ const content = await uploadedContentResponse.text()
351
+ const contentType = uploadedContentResponse.headers.get('Content-Type')
352
+
353
+ t.equal(contentType, 'text/gemini; charset=utf-8', 'got HTML mime type')
354
+ t.equal(content, SAMPLE_CONTENT, 'loaded index.html content')
355
+ })
336
356
  test('Read directory as HTML', async (t) => {
337
357
  const created = await nextURL(t)
338
358