News for hackers. Stuff that matters.
Re:Why I Tend Not to Use Content Negotiation by Gigachad on Monday November 20, 2023 @03:08AM (#38344368)
Everyone does this by putting /v1/ in the api url. It's massively more visible, gets logged properly, and isn't annoying to request from tools like curl.

The Accept header does nothing that URLs can not.

Re:Why I Tend Not to Use Content Negotiation by stephenr on Monday November 20, 2023 @04:18AM (#38345261)
You saying "no one needs that" doesn't mean it doesn't do more than some arbitrary url parameter or path segment. It means you're choosing not to use it.
Re:Why I Tend Not to Use Content Negotiation by Gigachad on Monday November 20, 2023 @07:33PM (#38357118)
If you can choose to not use it, then you don't need it. It doesn't enable any new capabilities.
Re:Why I Tend Not to Use Content Negotiation by naasking on Tuesday November 21, 2023 @12:15AM (#38359619)
> Everyone does this by putting /v1/ in the api url

URLs are opaque identifiers that only have meaning to the server that generated them. This makes any meaning implicit, where the accept header is an explicit and documented part of the interface. Maybe not much difference in practice for code you've interacted with, but that doesn't mean no difference at all.

If curl has trouble setting headers, that's a curl problem.