4 ms·
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
by MatthewPhillips 14y ago
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.
- qw 14y agoI 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.
- MatthewPhillips 14y agoNot 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".