better response format handling

Improved, but still no header-based negotiation.  That will be taken care of separately.

Issues closed from commits.