RangerMauve / hypercore-fetch

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

Use `Content-Type` `inode/directory` for directories #56

Closed josephmturner closed 1 year ago

josephmturner commented 1 year ago

Would you be open to setting the Content-Type header to the mime type inode/directory for directory listings (entry prefix listings)?

RangerMauve commented 1 year ago

Mind posting links to the spec for that content type and what the response should look like?

Right now it's serving plain JSON since that was the easiest approach. I'd be down to add new behavior with a custom Accept header that specifies that content-type though.

josephmturner commented 1 year ago

Spec: https://specifications.freedesktop.org/shared-mime-info-spec/shared-mime-info-spec-latest.html#idm140625828597376 (although from other cursory research, there appears to not be a universal mime type for directories)

The response could look the same as it does now with the difference being that Content-Type be set to inode/directory instead of application/json. Does that answer your question?

RangerMauve commented 1 year ago

Hmm, I'd rather keep the current version since it's most accurate to the actual content.

If there's a spec for representing directories out there, I'd love to revisit this then.

josephmturner commented 1 year ago

Sounds good to me, especially since directories (entry prefixes) always end with "/".