Skip to content

Commit

Permalink
Make JSON the default directory listing
Browse files Browse the repository at this point in the history
  • Loading branch information
makew0rld committed May 24, 2022
1 parent 3d31e56 commit 2a07981
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion go-ipfs/core/corehttp/gateway_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ func (i *gatewayHandler) getOrHeadHandler(w http.ResponseWriter, r *http.Request
// we need to figure out whether this is a directory before doing most of the heavy lifting below
_, ok := dr.(files.Directory)
// Also if it's a JSON or HTML directory listing
jsonListing := r.Header.Get("Accept") == "application/json"
jsonListing := r.Header.Get("Accept") == "application/json" || r.Header.Get("Accept") == ""

if ok {
if jsonListing {
Expand Down
1 change: 1 addition & 0 deletions spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ Download IPFS data.

#### Headers
- `Accept: application/json` return a JSON directory listing for directories
- No `Accept` header also returns JSON. HTML is returned if `Accept` has any other value.

#### Query params
- `noResolve` return a directory listing for a directory even if it contains an `index.html` file
Expand Down

0 comments on commit 2a07981

Please sign in to comment.