Fix authentication. Jquery append "*.*" to accept  by default so if we test text/html first it will alway be true. Then test first if application/json was given and then test if text/html then others.
Fix authentication. Jquery append "*.*" to accept  by
default so if we test text/html first it will alway be true. Then test
first if application/json was given and then test if text/html then
others.

Backported from trunk (related to COUCHDB-1175).

git-svn-id: eed9d206131b186e33f41325873c3684e4065c95@1126759 13f79535-47bb-0310-9956-ffa450edef68

PerilousApricot/bigcouch,cloudant/bigcouch,benoitc/bigcouch,benoitc/bigcouch,cloudant/bigcouch,breezjw/bigcouch,Asquera/bigcouch,Asquera/bigcouch,linearregression/bigcouch,georgemarshall/bigcouch,benoitc/bigcouch,kofron/bigcouch,Asquera/bigcouch,andrejb/cloudant_bigcouch,benoitc/bigcouch,Asquera/bigcouch,breezjw/bigcouch,georgemarshall/bigcouch,linearregression/bigcouch,kofron/bigcouch,PerilousApricot/bigcouch,linearregression/bigcouch,cloudant/bigcouch,linearregression/bigcouch,kofron/bigcouch,Asquera/bigcouch,bittorrent/bigcouch,bittorrent/bigcouch,georgemarshall/bigcouch,linearregression/bigcouch,cloudant/bigcouch,PerilousApricot/bigcouch,PerilousApricot/bigcouch,georgemarshall/bigcouch,georgemarshall/bigcouch,PerilousApricot/bigcouch,benoitc/bigcouch,bittorrent/bigcouch,benoitc/bigcouch,bittorrent/bigcouch,kofron/bigcouch,andrejb/cloudant_bigcouch,bittorrent/bigcouch,bittorrent/bigcouch,linearregression/bigcouch,kofron/bigcouch,andrejb/cloudant_bigcouch,Asquera/bigcouch,cloudant/bigcouch,breezjw/bigcouch,breezjw/bigcouch,breezjw/bigcouch,georgemarshall/bigcouch,andrejb/cloudant_bigcouch,andrejb/cloudant_bigcouch,cloudant/bigcouch,andrejb/cloudant_bigcouch,andrejb/cloudant_bigcouch,breezjw/bigcouch,cloudant/bigcouch,kofron/bigcouch,PerilousApricot/bigcouch,linearregression/bigcouch