3 ms·
Don't people use ?format=json or /foobar.json anyway?
by im3w1l 3y ago
Don't people use ?format=json or /foobar.json anyway?
- alganet 3y agoAs I said, if you're writing your own client and server, you don't need Accept. You probably use just one homogenized content type. Using `?format=json` is not offensive. It won't mess up some cache layer like improper status code semantics, so I don't really care that much about these if I see it. I wouldn't block a PR on that. The overall web on the other hand, is supposed to be made of many different client and server implementations. Your browser still relies on Accept headers for displaying images, detecting language, uncompress gzipped responses, resuming paused downloads, showing that JSON API in a nice UI when you open in a dedicated tab, so many things. To me, it makes sense to leverage the same content negotiation ideas for home grown stuff, even if only one content type is being used. It starts being a problem if you're working on microservices, and one of them uses `.json` while other uses `?format=json`, made by different teams. The standard is the obvious solution. Instead, they'll either create inefficient clients full of complexities or fight until one of the workarounds prevail. So much easier to follow the standard.