RangerMauve / hypercore-fetch

Implementation of Fetch that uses the Hyper SDK for loading p2p content
MIT License
37 stars 13 forks source link

Ensure that 'Must create key with POST before reading' error appears #39

Closed josephmturner closed 1 year ago

josephmturner commented 1 year ago

GET requests to a hyperdrive alias which hasn't been created by a POST like the following:

fetch(`hyper://localhost/?key=NOT-CREATED-YET`, { method: 'get' })

should return

{ status: 400, body: 'Must create key with POST before reading' }

but instead I get a TypeError.

I think getDBCoreForName is throwing an error before the if-block can run.

josephmturner commented 1 year ago

Thank you! I can confirm this is no longer an issue.