[GH-ISSUE #618] JSON "Accept" Headers #370

Closed
opened 2026-04-08 16:52:25 +03:00 by zhus · 2 comments
Owner

Originally created by @troygibb on GitHub (Aug 19, 2025).
Original GitHub issue: https://github.com/sigoden/dufs/issues/618

Specific Demand

Thanks so much for the great project! Love that getting it up and going is so easy. So far very happy with it.

One thing that seems a bit non-conventional is your use of a ?json query param. It would be more idiomatic to read the request's "Accept" header here and see if the request would accept application/json. Otherwise send back thml.

I double checked previous issues for this question/request here, and didn't see this come up before.

Implement Suggestion

See above!

Originally created by @troygibb on GitHub (Aug 19, 2025). Original GitHub issue: https://github.com/sigoden/dufs/issues/618 ## Specific Demand Thanks so much for the great project! Love that getting it up and going is so easy. So far very happy with it. One thing that seems a bit non-conventional is your use of a `?json` query param. It would be more idiomatic to read the request's ["Accept"](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Accept) header [here](https://github.com/sigoden/dufs/blob/9c9fca75d357da2e8e91f2ebbf406b88792c307a/src/server.rs#L1233) and see if the request would accept `application/json`. Otherwise send back thml. I double checked previous issues for this question/request [here](https://www.google.com/search?q=accept+site%3Agithub.com%2Fsigoden%2Fdufs%2Fissues&sca_esv=0cad35c59d313fc9&ei=hKCjaLn0LMvh0PEP6sKLiAo&ved=0ahUKEwi5xsWArJWPAxXLMDQIHWrhAqEQ4dUDCBA&uact=5&oq=accept+site%3Agithub.com%2Fsigoden%2Fdufs%2Fissues&gs_lp=Egxnd3Mtd2l6LXNlcnAiKmFjY2VwdCBzaXRlOmdpdGh1Yi5jb20vc2lnb2Rlbi9kdWZzL2lzc3Vlc0jIClAAWIAJcAB4AJABAJgBTKABoAOqAQE3uAEDyAEA-AEBmAIAoAIAmAMAkgcAoAe7ArIHALgHAMIHAMgHAA&sclient=gws-wiz-serp), and didn't see this come up before. ## Implement Suggestion See above!
zhus closed this issue 2026-04-08 16:52:25 +03:00
Author
Owner

@sigoden commented on GitHub (Aug 19, 2025):

There is a standard, but I've never seen any API designed like that. The ?json approach is still more common.

<!-- gh-comment-id:3198716376 --> @sigoden commented on GitHub (Aug 19, 2025): There is a standard, but I've never seen any API designed like that. The `?json` approach is still more common.
Author
Owner

@troygibb commented on GitHub (Aug 19, 2025):

For sure! In my experience mostly on the web side, it's pretty standard for servers to respect the Accept headers. No worries either way here was just pointing out a potential usability improvement 😄

<!-- gh-comment-id:3198842554 --> @troygibb commented on GitHub (Aug 19, 2025): For sure! In my experience mostly on the web side, it's pretty standard for servers to respect the Accept headers. No worries either way here was just pointing out a potential usability improvement 😄
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sigoden/dufs#370