RangerMauve / hypercore-fetch

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

Improve PUT response headers #80

Closed josephmturner closed 1 year ago

josephmturner commented 1 year ago

In hyperdrive.el, we need PUT responses to include headers which tell us information about the newly created entry.

Ideally, PUT requests would return all the same info that HEAD requests do. In order to implement this in a DRY manner, I refactored serveFile so that it can optionally return just headers.

Let me know what you think!

josephmturner commented 1 year ago

I think that overloading serveFile is probably not a great idea, but I didn't know how else to reuse the logic inside the isRanged block. I guess repetition is the lesser of two evils here.

RangerMauve commented 1 year ago

don't worry, I can give it a shot now

josephmturner commented 1 year ago

I just force-pushed what I think you were suggesting. I hope this looks good :)

RangerMauve commented 1 year ago

I just added the last modified and etag and link headers in the response of put and delete in the latest commit.

that should be a little more simple

josephmturner commented 1 year ago

Ok!