Skip to content

Commit db8720a

Browse files
authored
fix: use default verified-fetch contentTypeParser (#635)
* fix: use default verified-fetch contentTypeParser * chore: remove @sgtpooki/file-type dep * fix: content-type parser looks for html and text * chore: use latest verified-fetch
1 parent 1183f09 commit db8720a

File tree

6 files changed

+9
-107
lines changed

6 files changed

+9
-107
lines changed

package-lock.json

Lines changed: 4 additions & 36 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
"@helia/http": "^2.0.5",
4848
"@helia/interface": "^5.0.0",
4949
"@helia/routers": "^3.0.0",
50-
"@helia/verified-fetch": "^2.6.2",
50+
"@helia/verified-fetch": "^2.6.3",
5151
"@libp2p/crypto": "^5.0.15",
5252
"@libp2p/dcutr": "^2.0.26",
5353
"@libp2p/identify": "^3.0.26",
@@ -58,7 +58,6 @@
5858
"@libp2p/webtransport": "^5.0.36",
5959
"@multiformats/dns": "^1.0.6",
6060
"@noble/hashes": "^1.5.0",
61-
"@sgtpooki/file-type": "^1.0.1",
6261
"helia": "^5.3.0",
6362
"ipfs-css": "^1.4.0",
6463
"libp2p": "^2.8.1",

src/lib/content-type-parser.ts

Lines changed: 0 additions & 66 deletions
This file was deleted.

src/lib/get-verified-fetch.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import { createHelia, type Helia, type Routing } from 'helia'
2020
import { createLibp2p, type Libp2pOptions } from 'libp2p'
2121
import * as libp2pInfo from 'libp2p/version'
2222
import { blake3 } from './blake3.js'
23-
import { contentTypeParser } from './content-type-parser.js'
2423
import type { ConfigDb } from './config-db.js'
2524
import type { ComponentLogger } from '@libp2p/logger'
2625

@@ -86,7 +85,7 @@ export async function getVerifiedFetch (config: ConfigDb, logger: ComponentLogge
8685
})
8786
}
8887

89-
return createVerifiedFetch(helia, { contentTypeParser, withServerTiming: true, plugins: [dirIndexHtmlPluginFactory] })
88+
return createVerifiedFetch(helia, { withServerTiming: true, plugins: [dirIndexHtmlPluginFactory] })
9089
}
9190

9291
type Libp2pDefaultsOptions = Pick<ConfigDb, 'routers' | 'enableWss' | 'enableWebTransport' | 'enableGatewayProviders'>

test-e2e/origin-isolation-warning.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ test.describe('origin isolation warning', () => {
1313
// now click the button to accept the warning
1414
await page.click('.e2e-subdomain-warning button')
1515

16+
await expect(page.locator('.e2e-subdomain-warning')).not.toBeVisible()
17+
1618
// wait to be redirected to the test url
1719
await expect(page).toHaveURL(testUrl)
1820
})

test-e2e/path-routing.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ test.describe('path-routing', () => {
2020

2121
const headers = await response?.allHeaders()
2222

23-
expect(headers?.['content-type']).toBe('text/html')
23+
expect(headers?.['content-type']).toBe('text/plain; charset=utf-8')
2424
expect(headers?.['cache-control']).toBe('public, max-age=29030400, immutable')
2525

2626
// expect page content to contain 'hello'

0 commit comments

Comments
 (0)