Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It's not just one additional line of code. It is additional work every time you try to view result in the browser. Which you basically can't because you can't put accept header in url bar..

At least in python, making requests becomes quite a few more lines of code if you want to add headers. There's usually a short-hand command if you just want to get full data from an url and a "create-an-object, then set these parameters, then this, then open a connection then read what's there".

Mandatory headers are just a way to make life of a regular developer painful.



Sounds like you just need to abstract that part into a function. Much better solution than breaking HTTP. HTTP is not supposed to send the same results for a given URL, it is supposed to send the same results for the a given request. In the case of the browser, it asks for HTML.


I can see that using "Accept" can be considered a more elegant solution, I don't see how adding a parameter will break HTTP. There is nothing in the HTTP standard that says what an URL should or should not return. The Accept-header is just an additional source of information.


Not actually, the Accept header isn't a mere suggestion. If the server chooses not to fulfill it, the correct response is 406 Not Acceptable. This is why browsers send something like this in their Accept header:

Accept: text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8

This says "we would prefer one of these formats, but we'll take whatever you got".


This is exactly the reason why even the good standards fail. Instead of writing 10 lines of code to abstract your specific use case, you want it to be the default behavior. How many times have you cursed something like IE for not implementing CSS properly?


Modify Headers[1] lets you easily configure the headers your browser sends: https://addons.mozilla.org/en-US/firefox/addon/modify-header...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: